CatyH
Board Regular
- Joined
- Jun 27, 2017
- Messages
- 84
- Office Version
- 365
Macro creates a set of slicers (about 200!) and sets position and properties as it goes. But I'm stymied: no way to force slicer to be in "multi-select" mode when it's created? Do I really need to go through each slicer after it's created and click the multi-select icon on each one? [ I did try recording macro to make the selection to multi-select on various slicers but apparently this is an invisible action that wasn't even recorded! ]
Or... is there some code to force slicer to be in multi-select mode? THANK YOU IN ADVANCE!
*************************
My current code to create a slicer, called from macro that defines the specifics for location, name, etc...
Or... is there some code to force slicer to be in multi-select mode? THANK YOU IN ADVANCE!
*************************
My current code to create a slicer, called from macro that defines the specifics for location, name, etc...
VBA Code:
Sub AddSlicer(Name As String, SlicerName As String, Top As Integer, Left As Integer, Width As Integer, Height As Integer, Columns As Integer, Style As String, Caption As String)
'
With ActiveWorkbook
.SlicerCaches.Add2(ActiveSheet.PivotTables("PivotTable1"), Name).Slicers.Add ActiveSheet, , Name, Name, Top, Left, Width, Height
With .SlicerCaches(SlicerName).Slicers(Name)
.NumberOfColumns = Columns
.Style = Style
.Caption = Caption
.DisplayHeader = True
.SlicerCache.CrossFilterType = xlSlicerCrossFilterHideButtonsWithNoData ' buttons don't display when no data
'.SlicerCache.CrossFilterType = xlSlicerCrossFilterShowItemsWithDataAtTop ' buttons with no data DO display
.SlicerCache.SortItems = xlSlicerSortAscending
.SlicerCache.SortUsingCustomLists = True
.SlicerCache.ShowAllItems = True
End With
End With
End Sub