I'm working on a pivot table macro that filters certain fields in the macro. However, whenever that field doesn't populate the macro breaks.
Here is an example, I have no 'email' counts in my data and therefore the debugger stops at this point in the formula.
Sheets("Call Work Code").Select
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Call Work Code")
.PivotItems("EMAIL").Visible = False
.PivotItems("FAX").Visible = False
End With
How can I plug in an if statement so that if it is not applicable move onto the next field?
Thanks in advance!
Here is an example, I have no 'email' counts in my data and therefore the debugger stops at this point in the formula.
Sheets("Call Work Code").Select
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Call Work Code")
.PivotItems("EMAIL").Visible = False
.PivotItems("FAX").Visible = False
End With
How can I plug in an if statement so that if it is not applicable move onto the next field?
Thanks in advance!