Hi! how can I reorganize the order of the pivot fields: Client Type, Product, Side. When I run the below, the rows are in the following order: side, product, client type:
VBA Code:
'START pivot
ActiveSheet.UsedRange.Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
Sheets(1).UsedRange).CreatePivotTable TableDestination:="", _
TableName:="Pivot Summary", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
'Insert Side to Row Filed & position 2
With ActiveSheet.PivotTables("Pivot Summary").PivotFields("Client Type")
.Orientation = xlRowField
.Position = 1
End With
'Insert Side to Row Filed & position 2
With ActiveSheet.PivotTables("Pivot Summary").PivotFields("Product")
.Orientation = xlRowField
.Position = 1
End With
'Insert Side to Row Filed & position 2
With ActiveSheet.PivotTables("Pivot Summary").PivotFields("Side")
.Orientation = xlRowField
.Position = 1
End With
'Insert Qty column to the data field
With ActiveSheet.PivotTables("Pivot Summary").PivotFields("Volume")
.Orientation = xlDataField
.Position = 1
.NumberFormat = "#,##0;(#,##0)"
ActiveWorkbook.RefreshAll
'Turn on Automatic updates/calculations --like screenupdating to speed up code
pvt.ManualUpdate = False
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True