How do I change source data range for an existing Pivot Table?

P

Paolo Sardi

Hi,

I'm trying to change, through Excel VBA code, the source data range for an
existing Pivot Table.

Is there a way to set a new data source range for an existing Pivot Table?

Thank you.
 
Joined
Apr 29, 2008
Messages
66
Reaction score
0
Hi Paolo,
Try:
Range("K4").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:=ActiveSheet.Range("NewDataSourceRange")
The range selected (K4 here) should be a cell within the pivot table.
Paul
 

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