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?
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?