ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Values (https://www.excelbanter.com/excel-programming/278601-pivot-values.html)

Bradford Patten

Pivot Values
 
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




All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com