I'm trying to select and deselect multiple slicer items from a single slicer without having it trigger an update until all my selections are complete. I'm able to do this pretty simply in the Excel front-end by Ctrl-clicking all the selections I want. However, when I record a macro with this behavior and run it, it updates after each selection/deselection (the recorded macro is just a bunch of .Selection = True/False
statements within a With
block).
I've tried using the SlicerCaches.VisibleSlicerItemsList
function, but that throws a 1004 Application error - even when I've used the SlicerItem.Name
field to populate the array:
Dim tntw(0 To 2) as Variant
For i = 0 To 2
tntw(i) = sc.SlicerItems(i + 1).Name
Next i
sc.VisibleSlicerItemsList = tntw
I've also tried setting all dependent PivotTables to manual update for this, as well as trying to set the application.calculation to manual (and switching both back at the end), but neither accomplish what I'm looking for.
Any ideas?
Application.EnableEvents = False
before executing the code and then resetting it after?? – Joseph