SlicerCache.SortItems procedure builder

SlicerCache.SortItems (Excel)

Returns or sets the sort order of the items in the slicer.

Possible Values are xlSlicerSortAscending - Slicer items are sorted in ascending order by item captions, xlSlicerSortDataSourceOrder - Slicer items are displayed in the order provided by the data source, xlSlicerSortDescending - Slicer items are sorted in descending order by item captions.

The default setting of this property is xlSlicerSortAscending. The SortItems property only applies to slicers that are based on PivotTables that are connected to workbook ranges or lists (SlicerCache.SourceType = xlDatabase). Attempting to access the SortItems property for slicers that are connected to OLAP data sources (SlicerCache.OLAP = True) generates a run-time error. For OLAP data sources, use the SortItems property of the SlicerCacheLevel object instead.

ActiveWorkbook.SlicerCaches(1).SortItems = xlSlicerSortAscending