After looking through posts I thought I had good code to loop through slicer items to find the one I want, and make it selected, otherwise deselect it. But I keep getting Error 1004 on the "For Each si" line.
What am I doing wrong?
Thank you!
VBA Code:
Dim sc As SlicerCache, si As SlicerItem
Set sc = ActiveWorkbook.SlicerCaches("Slicer_BU")
sc.ClearAllFilters
For Each si In sc.SlicerItems
If si.Name = "ADS" Then
sc.SlicerItems(i).Selected = True
Else
sc.SlicerItems(i).Selected = False
End If
Next
What am I doing wrong?
Thank you!
Last edited: