Datafield in pivot table switched!

Devotchka

New Member
Joined
Jun 8, 2010
Messages
13
I used the record feature to pick two categories "Sum of vol_gross" and "Sum of vol_net" and put those in the Data field. After the table was created I dragged them both to the Totals area so that it reflected the correct values. For a while the vol_gross was in column J and vol_net in column K, then for some random reason they switched. Any help with keeping vol_gross in column J and vol_net in column K would be really appreciated!!

This is the code I have so far:

With ActiveSheet.PivotTables("PivotTable3").PivotFields("vol_gross")
.Orientation = xlDataField
.Caption = "Sum of vol_gross"
.Position = 1
.Function = xlSum
End With
With ActiveSheet.PivotTables("PivotTable3").PivotFields("vol_net")
.Orientation = xlDataField
.Caption = "Sum of vol_net"
.Position = 1
.Function = xlSum
End With
Range("K3").Select
With ActiveSheet.PivotTables("PivotTable3").DataPivotField
.Orientation = xlColumnField
.Position = 1
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,215,741
Messages
6,126,592
Members
449,320
Latest member
Antonino90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top