With ActiveSheet.PivotTables("PivotTable5").PivotFields("Letter Code")
.PivotItems("A").Visible = False
.PivotItems("B").Visible = False
.PivotItems("C").Visible = False
.PivotItems("D").Visible = True
.PivotItems("E").Visible = True
End With
Hi I have the above code for a pivot table. Sometimes however, there are no cells with "D" in the pivottable, as a result the macros crashes at this point because it is expecting to check it off as existing in the pivottable. I was wondering if there is a way to check off TRUE only if it exists in the pivot table. Same also applies with unchecking as False only if it exists as one of the selections in the pivot table.
Bookmarks