View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
M Carman M Carman is offline
external usenet poster
 
Posts: 2
Default How to Set datarange for pivot table?

What is the correct way to update the data source for a pivot table? All I've
come up with is the following, but the new data range does not apply when the
code runs. Is there a way to update the range directly wthout using the
PivotTableWizard method? Is there a way to use "A1" referencing instead of
"R1C1"?

dim X as integer
Sheets("ws1").PivotTableWizard SourceType:=xlDatabase, _
SourceData:="ws2!R1C1:R" & X & "C15"

--
M Carman