The following code deselects it from a pivot table. What happens if it is not there to deselect? Is there a way to rewrite this so whether it is, or is not there is will deselect it?
ActiveSheet.PivotTables("PivotTable4").PivotFields("Ship To Name").CurrentPage _ = "(All)" With ActiveSheet.PivotTables("PivotTable4").PivotFields("Ship To Name") .PivotItems("Haworth Holland Customer CPU ").Visible = False End With ActiveSheet.PivotTables("PivotTable4").PivotFields("Ship To Name"). _ EnableMultiplePageItems = True
Rgonzo1971 suggestion did not work, unless he was referring to put it into the error handler?
Question on the: On Error what does the on error goto 0 do? Is the zero no where? or a position?
I have used goto 100 or goto 200 but they have always referred to a different place in the procedure
Rory Archibald
It just clears the error handler - i.e. cancels the On Error Resume Next.
With ActiveSheet.PivotTables("P
.PivotItems("Haworth Holland Customer CPU ").Visible = False
End With
then try
set myItem = ActiveSheet.PivotTables("P
.PivotItems("Haworth Holland Customer CPU ")
If Not myItem Is Nothing Then myItem.Visible = False
Regards