How to Set datarange for pivot table?

M

M Carman

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top