ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing Pivot Range Programatically (https://www.excelbanter.com/excel-programming/298259-changing-pivot-range-programatically.html)

Reney Langlois

Changing Pivot Range Programatically
 
Hi,
I'd like to change the range of cells that a pivot table
is referring to in code. Right now, when I record a macro
to do this, the resulting code utilizes the pivot wizard
but I've got to believe that there's a more direct way to
do this.

Thanks much,

Reney

Tim Zych[_8_]

Changing Pivot Range Programatically
 
Use SourceData

PivotTableObj.SourceData = "NewlyResizedRangeName"


"Reney Langlois" wrote in message
...
Hi,
I'd like to change the range of cells that a pivot table
is referring to in code. Right now, when I record a macro
to do this, the resulting code utilizes the pivot wizard
but I've got to believe that there's a more direct way to
do this.

Thanks much,

Reney





All times are GMT +1. The time now is 12:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com