I´m a newbie with VBA and need to learn how to change automatically the selected values on a Slicer. I first tried with a very simple one, but I tried every variation possible to the following code and always get an error 1004, this time "application-defined or object-defined error"
Sub SlicerSelect()
With ActiveWorkbook.SlicerCaches("Slicer_Time")
.SlicerItems("2016").Selected = False
End With
End Sub
Does someone have an idea ? Here is also an image of my slicer and its settings.
By the way, it works when I'm using the .ClearManualFilter command.
Thanks a lot !
Here is also a macro record by filtering manually my items :
Sub Macro2()
' Macro2 Macro
ActiveWorkbook.SlicerCaches("Slicer_Time2").VisibleSlicerItemsList = Array( _
"[Booking Period].[Time].[YEAR].&[2018]")
End Sub