I want to get items in pivot analysis filter using VBA , Is there any function support?
CodePudding user response:
Try the following code.
Sub test()
Dim pt As PivotTable
Dim pf As PivotField
Set pt = Sheets("Sheets").PivotTables("PivotTables")
Set pf = pt.PivotFields("PivotFields")
With pf
For i = 1 To .PivotItems.Count
Debug.Print .PivotItems(i).Name
Next i
End With
End Sub