I have a pivot table that comes from a data model, and I want to find a macro that will deselect one item named "Headcount". I've tried the two approaches below, but I can't get either to work. Could someone please help point me in the right direction?
Thanks!
First Approach:
Thanks!
First Approach:
Code:
Sub Macro3()
ActiveWorkbook.SlicerCaches("Slicer_Project_Name").ClearManualFilter
SelectSlicerValue "Slicer_Project_Name", "Headcount", False
End Sub
Second Approach:
Sub Macro1()
Dim a As String
a = "Headcount"
With ActiveWorkbook.SlicerCaches("Slicer_Project_Name")
For I = 1 To .SlicerItems.Count
.SlicerItems(I).Selected = True
If .SlicerItems(I).Value = a Then
.SlicerItems(I).Selected = False
End If
Next
End With
End Sub
Last edited by a moderator: