I have a pivot table that I want to hide all the pivot items in the page field except (blank). Since the pivot items are subject to change, I don't want to select them by name or array.
This code I'm using gives me a run time error 1004: Unable to set the Visible property of the PivotItem class on the line that says "PvI.Visible = False"
Any suggestions, please?? ![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
This code I'm using gives me a run time error 1004: Unable to set the Visible property of the PivotItem class on the line that says "PvI.Visible = False"
Code:
Set Tbl = Sheets("Col I & J (2)").PivotTables(1)
For Each PvI In Tbl.PivotFields("REFERRED_CONTACT_NAME").PivotItems
If PvI.Name = "(blank)" Then
PvI.Visible = True
Else
PvI.Visible = False
End If
Next PvI