Hi All,
As you can see in the attached file, I have pivot table where I want to loop through each pivot item in pagefield and do something with the filtered data.
I tried with this code but it shows error(screenshot attached in file itself).
Kindly help me.
Sub LoopThroughPivotItems()
Dim PT As PivotTable
Dim PF As PivotField
Dim PI As PivotItem
Set PT = ActiveSheet.PivotTables("PivotTable1")
Set PF = PT.PivotFields("Provider")
For Each PI In PF.PivotItems
PI.Visible = True ' Error is occuring here
Next PI
End Sub
May I know where I am going wrong?
With Regards
Rudra
As you can see in the attached file, I have pivot table where I want to loop through each pivot item in pagefield and do something with the filtered data.
I tried with this code but it shows error(screenshot attached in file itself).
Kindly help me.
Sub LoopThroughPivotItems()
Dim PT As PivotTable
Dim PF As PivotField
Dim PI As PivotItem
Set PT = ActiveSheet.PivotTables("PivotTable1")
Set PF = PT.PivotFields("Provider")
For Each PI In PF.PivotItems
PI.Visible = True ' Error is occuring here
Next PI
End Sub
May I know where I am going wrong?
With Regards
Rudra