I seem to have a small problem with a Pivot Table on a file that we get weekly. I've built a macro to run across the file to format it and refresh. The problem is, sometimes it fails because the Pivot Table is listed as "PivotTable1" and sometimes it comes through as "PivotTable2". I'd like to amend it so that regardless of it's name, it can be renamed to "MainPivot" or something similar.
All I can get upto so far is:
Is there anyway to amend the macro to select the pivot (there's only one on the sheet) regardless of what it's initially called?ActiveSheet.PivotTables("PivotTable1").Name = "MainPivot"
Thanks!
Last edited by McNulty; 05-08-2009 at 06:29 PM.
You could use the ordinal instead of the name...
Actually, as long as there is only one, you could just use PivotTable(1) in your macro and then it doesn't matter what it is called.ActiveSheet.PivotTables(1).Name = "MainPivot"
Fantastic - many thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks