PDA

View Full Version : Solved: For Each and Pivot Table items?



next
04-26-2012, 08:48 AM
I need to manually sort pivot table and to do that I need to get all the label values. This doesn't seem to work:
Sub Macro1()
Dim item As PivotItem
'ActiveSheet.PivotTables("PivotTable1").PivotFields("Year/Month").PivotItems("20106").Position = 1
For Each item In ActiveSheet.PivotTables("PivotTable1").PivotFields("Year/Month")
Debug.Print item
Next item
End Sub
How do I loop through items in a pivot table?

CatDaddy
04-26-2012, 02:17 PM
http://jamiche.blogspot.com/2011/04/vba-looping-through-items-in-pivot.html