kreepa
01-24-2008, 12:55 PM
I am trying the tweak the code below to create a pivot chart on a new chart for each pivot field item. The could works as it was designed to create a message box based on each pivot field item, I just need it to do more. How can I revise it?
http://i18.photobucket.com/albums/b146/sbullard/rcmexcelsnag.png
Sub LoopPivotPageFields()
Dim pt As PivotTable, ptf As Variant, pti As Variant
For Each pt In ActiveSheet.PivotTables
pt.PivotFields
For Each ptf In pt.PageFields
For Each pti In pt.PivotFields(ptf.Name).PivotItems
MsgBox "Pivot Page Field: " & ptf.Name & " - Pivot Page Field Item: " & pti.Name
Next pti
Next ptf
Next pt
End Sub
http://i18.photobucket.com/albums/b146/sbullard/rcmexcelsnag.png
Sub LoopPivotPageFields()
Dim pt As PivotTable, ptf As Variant, pti As Variant
For Each pt In ActiveSheet.PivotTables
pt.PivotFields
For Each ptf In pt.PageFields
For Each pti In pt.PivotFields(ptf.Name).PivotItems
MsgBox "Pivot Page Field: " & ptf.Name & " - Pivot Page Field Item: " & pti.Name
Next pti
Next ptf
Next pt
End Sub