I often update Pivot tables from VBA, but if I change the pivot table
layout, the pivot table receives a new name (at least that's what I
think happens) and my VBA-code fails.
Originally I have found the name of the pivot table by recording a
macro, but it seems daft to have to do this every time I change the
layout.
Example:
Sheets("Pivot Finished").Select
Range("A4").Select
ActiveSheet.PivotTables("Pivottabell4").PivotCache.Refresh
If I have changed the pivot table, I get a message saying (translated):
"Can't find the PivotTables Property for the Worksheets Class"
Anyone?