I have inherited a report that has 2 Worksheets ...
WS1 = multiple Pivot Tables
WS2 = 2 Slicers and Report output
Slicer1 = Year
Slicer2 = Month
I have some VBA code to print the active WS to a PDF file (with a unique filename) - in WS2 I want to cycle through the Slicer2 selections, each time invoking my code ie to print to 12 PDF files for Jan-Dec - this is how my Module starts, but I also need to deselect all but the current sI and you can't deselect all then select one (at the moment I just add the sI to the selection, rather than it being only the sI selected) - have looked at a number of ideas I've found but none quite fit - any ideas?
Thanks in advance
WS1 = multiple Pivot Tables
WS2 = 2 Slicers and Report output
Slicer1 = Year
Slicer2 = Month
I have some VBA code to print the active WS to a PDF file (with a unique filename) - in WS2 I want to cycle through the Slicer2 selections, each time invoking my code ie to print to 12 PDF files for Jan-Dec - this is how my Module starts, but I also need to deselect all but the current sI and you can't deselect all then select one (at the moment I just add the sI to the selection, rather than it being only the sI selected) - have looked at a number of ideas I've found but none quite fit - any ideas?
Thanks in advance
VBA Code:
Private Sub SlicerNamePDF()
Dim sC As SlicerCache
Dim sI As SlicerItem
Set sC = ActiveWorkbook.SlicerCaches("Slicer_Month")
For Each sI In sC.SlicerItems
sI.Selected = True