Pivot and columns order

T

Tewari

Can I change the order of the columns before/after the creation of the
pivot using VBA>BY order of columns I mean If I have Total Last Year,
Total This Year, Jan2006,Feb2006,...,June2006,July2006 as the columns
in pivot then can I make them to appear as
Jan2006,Feb2006,...,June2006,July2006 ,Total This Year,Total Last Year
If there is any confusion pl write me back , I will send you the exact
Pivot.
Also is it possible to remove some of the columns from Pivots?
I want to use VBA to do it.
 
E

Excelenator

Assuming you only have the 9 columns you laid out in your example yo
can use this code. You would have to adjust the .Position = *-[tota
num cols]-* if they differ.



Code
-------------------
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Total This Year")
.Orientation = xlColumnField
.Position = 9
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Total Last Year")
.Orientation = xlColumnField
.Position = 9
End Wit
 
Top