I am a newbie in VBA and trying to select several item in a slicer for a pivot table. I created already an array with all items in it, which should be chosen. But my code only selects one single item at once. Could you guys help me please?
For cnt = UBound(Visible_Both_Years) To 0 Step -1 'filled array MsgBox Visible_Both_Years(cnt) 'Loop through filter With k For Each l In .PivotItems Select Case l.Name Case Is = Visible_Both_Years(cnt) l.Visible = True Case Else l.Visible = False End Select Next End With
I appreciate any help!