I've seen a few forum posts on this but the suggestions are still not working for me. I've attached a smaller version of my spreadsheet. I'm pulling data from "Data Entry" and the PivotTable is on "Full Query". I would like to use the command button to have it reset all the PivotFields but keep getting the error "Unable to get PivotItems property from the PivotField class".
I'm hoping someone can look at the code below that I have in there and also my spreadsheet to figure out what I'm doing wrong.
Thanks ahead of time!
Private Sub CommandButton1_Click()
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Name")
.PivotItems("(Show All)").Visible = True
ActiveSheet.PivotTables("PivotTable2").PivotFields ("DEPT")
.PivotItems("(Show All)").Visible = True
ActiveSheet.PivotTables("PivotTable2").PivotFields ("CERTIFICATION ")
.PivotItems("(Show All)").Visible = True
ActiveSheet.PivotTables("PivotTable2").PivotFields ("EXP DATE")
.PivotItems("(Show All)").Visible = True
ActiveSheet.PivotTables("PivotTable2").PivotFields ("LICENSE")
.PivotItems("(Show All)").Visible = True
End With
End Sub
Bookmarks