I'm setting up some code that will peform a series of calculations off a pivot table. I want the code to cycle through all the pages in the pivot table. I've indexed the pages (1 to X), but there may be instances where there may be numbers missing. It will mess up my calculations if I try to go to pivot on a page that does not exist.
This is how I would change the page 9 in VBA
This is my feeble attempt to cycle through all the Pages and where I need hep! I really have no clue. =)
This is how I would change the page 9 in VBA
Code:
AvgCost.PivotTables("AvgCost").PivotFields("Period").CurrentPage = "9"
Call PeformCalculations
This is my feeble attempt to cycle through all the Pages and where I need hep! I really have no clue. =)
Code:
Dim PivotSheet As Sheets
With AvgCost.PivotTables("AvgCost").PivotFields("Period")
.ManualUpdate = True
For Each PivotSheet In AvgCost.PivotTables("AvgCost").PivotFields("Period")
Call PeformCalculations
Next PivotSheet
.ManualUpdate = False
End With
Last edited: