View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Debra Dalgleish Debra Dalgleish is offline
external usenet poster
 
Posts: 2,979
Default Change SourceData in Excel PivotTable via VBA

What error do you get, and which line is highlighted?

CarlsonClan < wrote:
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 worksheet
the pivot table is in) from one file and pasting it to each file. At
this point, all I want to do is update the SourceData to reflect a
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. Does
anyone have any suggestions?


--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html