B
Bradford Patten
Can anyone assist me in finding the value of a pivot table field?
I have the following code which cycles through my states, but I want to get
the value associated with each one:
With Activesheet.PivotTables(1).PivotFields("STATE")
For i = 1 to .PivotItems.Count
temp = .PivotItems(i)
Next i
End With
I would like something exactly like GETPIVOTDATA, but it doesn't seem to be
available in VBA. I have played with grabbing the value from the appropriate
cell on the sheet, but if you change the layout this fails. I have also
played with setting a cell with the GETPIVOTDATA function and taking the
data from that cell, but it seems there has to be a simple code to get the
value of an item in a pivot.
Thanks,
--bnpatten
I have the following code which cycles through my states, but I want to get
the value associated with each one:
With Activesheet.PivotTables(1).PivotFields("STATE")
For i = 1 to .PivotItems.Count
temp = .PivotItems(i)
Next i
End With
I would like something exactly like GETPIVOTDATA, but it doesn't seem to be
available in VBA. I have played with grabbing the value from the appropriate
cell on the sheet, but if you change the layout this fails. I have also
played with setting a cell with the GETPIVOTDATA function and taking the
data from that cell, but it seems there has to be a simple code to get the
value of an item in a pivot.
Thanks,
--bnpatten