Hi,
I am trying to filter a pivot table field named ("id") with ID="xyz". Below is the code I am using however I am getting a application or object defined error. Please let me know how to fix this error. Thanks for your help.
Sub filter()
With Worksheets("xyz").PivotTables(1)
.PivotFields("id").PivotFilters.Add Type:=xlCaptionEquals, Value1:="B10059"
End With
End Sub
I am trying to filter a pivot table field named ("id") with ID="xyz". Below is the code I am using however I am getting a application or object defined error. Please let me know how to fix this error. Thanks for your help.
Sub filter()
With Worksheets("xyz").PivotTables(1)
.PivotFields("id").PivotFilters.Add Type:=xlCaptionEquals, Value1:="B10059"
End With
End Sub