Reputation: 11
I am attempting to write a macro but am caught up. How do you create a loop that will loop through only visible objects in an already filtered slicer.
Image below is the slicer I want to use ("slicer_Route") and I only the loop to loop through the first 4 darkened objects. (These were the result of another filter)
SLICER:
Upvotes: 1
Views: 2127
Reputation: 28955
I don't know what you want to do but this goes through Visible Items:
Dim sC As SlicerCache
Dim sI As SlicerItem
Set sC = ActiveWorkbook.SlicerCaches("Slicer_Route")
For Each sI in sC.SlicerItems
If sI.Selected = True Then
Debug.Print sI.Name 'This is an example, you can do what you want with that item
End If
Next sI
If you provide more detailed question, you may get further help.
Upvotes: 1