Hello,
I'm trying to write VBA code to hide all fields of a pivot table except one. I don't know what all the fields will be, except for the one I want to remail visible. Here's what I have so far:
Sub Macro1()
Dim Region As String
Region = Range("E16").Value
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Label")
.PivotItems("*").Visible = False
.PivotItems(Region).Visible = True
End With
End Sub
Unfortunately, the code errors on the "*" wildcard. Any help on a workaround would be much appreciated! Thanks.
Brad
Bookmarks