I tried using the code that appeared to have helped the poster at
Excel VBA - Privot table filter multiple criteria
But I keep on getting the following error: Unable to get the PIvtoFields property of the PIvotTable Class.
Sub FilterPivotItems()
Dim PT As PivotTable
Dim PTItm As PivotItem
Dim FiterArr() As Variant
' use an array to select the items in the pivot filter you want to keep visible
FiterArr = Array("MC. Santa Clara", "MC. Plaza Américas", "MC. El Frutal")
' set the Pivot Table
Set PT = ActiveSheet.PivotTables("PivotTable4")
' loop through all Pivot Items in "Value" Pivot field
For Each PTItm In PT.PivotFields("Value").PivotItems
If Not IsError(Application.Match(PTItm.Caption, FiterArr, 0)) Then ' check if current item is not in the filter array
PTItm.Visible = True
Else
PTItm.Visible = False
End If
Next PTItm
End Sub
What can I do?