I've got code I've been using for a while to select my Strategies in a pivot table. Now it's not working correctly. No error message, but it's only selecting B.1.1, not B.1.2. I can't find anything in the formatting of B.1.1 and B.1.2 that's causing a problem. I've attached a sample of my pivot. Any help on this is greatly appreciated.
Dim Pt As PivotTable, Pi As PivotItem, Pf As PivotField
Set Pt = ActiveSheet.PivotTables("PivotTable1")
'Change the pivot table to only give us the info we need
With Pt.PivotFields("FY 10-11 STRATEGY")
For Each Pi In Pt.PivotFields("FY 10-11 STRATEGY").PivotItems
If Pi = "B.1.1" Or pvtItem = "B.1.2" Then
Pi.Visible = True
Else
Pi.Visible = False
End If
Next
End With
Bookmarks