Excel Macro to "Select All" in Pivot Table Field
I have the code below to "turn off" certain values of a field in a Pivot Table, but how do I accomplish this if I want to "turn on" all values in a field of a Pivot Table?
Thanks
Dim pi_2 As PivotItem
With ActiveSheet.PivotTables("PivotTable3").PivotFields ("Order")
For Each pi_2 In .PivotItems
If pi_2.Caption = "(blank)" And pi_2.Visible = True Then
pi_2.Visible = False
Exit For
End If
Next
End With
Dim pi_3 As PivotItem
With ActiveSheet.PivotTables("PivotTable3").PivotFields ("Order")
For Each pi_3 In .PivotItems
If pi_3.Caption = "#N/A" And pi_3.Visible = True Then
pi_3.Visible = False
Exit For
End If
Next
End With
|