ピボットテーブルがあり、ネストされたRowFieldsを反復処理する必要があります。
ネストされたRowFieldsを解析するにはどうすればよいですか?
これまでの私のコードは次のとおりです。
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
たとえば、ブランド「AAA」に関連するすべてのネストされた記事コードと、関連するNsum値を次のように取得する必要があります(これは機能しません。):
...
pt.RowFields(1).PivotItems(1).RowFields(2).PivotItems(j)
...