Does anyone know how I'd make a VBA statement that says if pivot table "A" contains a pivot item "B", then hide "B" in the pivot table.
This is what I have so far, but it throws an error if the pivot table doesn't contain "0":
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Date")
.Orientation = xlColumnField
.Position = 1
.PivotItems("0").Visible = False
.PivotItems("(blank)").Visible = False
End With
This is what I have so far, but it throws an error if the pivot table doesn't contain "0":
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Date")
.Orientation = xlColumnField
.Position = 1
.PivotItems("0").Visible = False
.PivotItems("(blank)").Visible = False
End With