Hello,
Whenever I add a new field to a pivot table, it is placed in the rightmost column. I would like my macro to make it be the leftmost column. Whenever my macro comes across this code " .Orientation = xlColumnField", Excel freezes and the only way to close Excel is by using the Task Manager. Following is my code:
If Range("B3").Value = "Gross Sales" Then
ActiveSheet.PivotTables("PivotTable1").PivotFields("Net Sales").Orientation = xlHidden
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Gross Sales "), "Anzahl von Gross Sales ", xlCount
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Anzahl von Gross Sales " _
)
.Caption = "Gross Sales"
.Function = xlSum
.NumberFormat = "#.##0"
.Orientation = xlColumnField
.Position = 2
End With
Maybe my code is not even correct to change the column orientation.
Any help would be greatly appreciated!
~az!
Bookmarks