I have a Pivot Table and I need to iterate through nested RowFields:
How can I parse the nested RowFields?
My code so far is:
Sub PtRead()
Dim i As Integer, j As Integer
Dim Sh As Worksheet
Dim pt As PivotTable
Dim rngRow As Range
Set Sh = Sheets("Store")
Set pt = Sh.PivotTables(1)
i = 3
For j = 1 To pt.RowFields(i).PivotItems.Count
Debug.Print pt.RowFields(i).PivotItems(j)
Next
End Sub
I need to retrieve, for example, all the nested article codes related to brand "AAA" and the related Nsum value with something like (this doesn't work..):
...
pt.RowFields(1).PivotItems(1).RowFields(2).PivotItems(j)
...