VBA, PivotTable: Move the first PivotField, regardless of name, to the last position

wookieking

New Member
Joined
Nov 7, 2017
Messages
1
I have a workbook with about 30 tabs that each have 6 PivotCharts. Each PivotChart has 12 PivotFields (Values) corresponding to the months of the year. These are basically creating a rolling year effect after data is updated. To do this effect, I need to take the PivotField in .Position = 1 and change it to .Position = 12 each time the macro is run.

I obviously can't use .PivotTables("xyz").PivotFields("Nov") because the top won't always be "Nov". I don't want to make the field name dependent upon when the macro is run because it might not be run in the correct month causing the months to be out of order and/or not being reflective of when the report actually should have been run.

Everything I've found doesn't tell me how to grab the name value of field 1. Lots of stuff telling me how to get the position value of a hard coded name, though.

Any help is appreciated.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,214,994
Messages
6,122,633
Members
449,092
Latest member
bsb1122

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