Link to home
Start Free TrialLog in
Avatar of jwandmrsquared

asked on

Excel PivotTable Field Name customization

I have a pivot table that gets used very frequently from a common cache (range name).  We have 3 different scenarios where we need to pull fields in an out of the value grid (NOTE:  these are NOT column fields - they are value fields) and we have to rename them each time.  I have already discovered that

ActiveSheet.PivotTables("Cap_reports").PivotFields("Sum of Jan Cap").Caption = _
works - IF that value is in the grid at the time.  If Sum of Jan Cap is not chosen, I get an object error.

I have 24 possibilities of value field renaming (changing Sum of Jan Cap to Jan, same with Jan Exp, etc) that I am willing to use if statements to execute, but I don't know how to say "if Sum of Jan Cap" exists in the grid, then execute ActiveSheet.PivotTables("Cap_reports").PivotFields("Sum of Jan Cap").Caption = _
I plan to attach the code to a button.

Avatar of IrogSinta
Flag of United States of America image

I couldn't follow this.  Is it possible for you to upload a sample spreadsheet with some data?
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jwandmrsquared


Simple and effective.  Thank you!