-
pivot table pagefield
Hi,
I have a pivot table which stores data for each date on a separate page, ie the page field in the pivot table is the date. Now I want to increment the page fields through VBA. All I can find is a current page method. I cannot do it otherwise because my data keeps changing and I dont know what dates I got, so this has to be generically.
Any ideas,
thx
Sunil.
-
Something like this :-
'-----------------------------------------
For Each Pi In ActiveSheet.PivotTables("PivotTable1"). _
PivotFields("Type").PivotItems
MsgBox (Pi)
Next
'-----------------------------------------
-
Sorry, got distracted and didn't finish it off :-
'-----------------------------------------
Dim pt As PivotTable
Dim PF As PivotField
Set pt = ActiveSheet.PivotTables("PivotTable1")
Set PF = pt.PivotFields("Type")
'--------------------
For Each Pi In PF.PivotItems
PF.CurrentPage = Pi
MsgBox (Pi)
Next
'-----------------------------------------
-
hmm, tried that earlier as well, but the code is giving me an error.
The error is "Unable to set the _default property of the pivotitem class".
I looked at the object browser for the _default class, its under hidden members. But the help for this didnt reveal much.
What do you think?:confused:
Thx for replying,
Sunil.