Change SourceData in Excel PivotTable via VBA

C

CarlsonClan

I am updating a number of files that all require the same pivot table
so I am copying a "standard" pivot table (actually, the whole workshee
the pivot table is in) from one file and pasting it to each file. A
this point, all I want to do is update the SourceData to reflect
named region ("RawData") in each file.

The following gives me an error:

ActiveSheet.PivotTableWizard SourceType:=xlDatabase, _
SourceData:="RawData"
ActiveSheet.PivotTables("RT Data").PivotCache.Refresh

The pivot table is called "RT Data", so that is not the error. Doe
anyone have any suggestions
 
Top