我有一个数据透视表,我需要遍历嵌套的 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)
...