ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Set datarange for pivot table? (https://www.excelbanter.com/excel-programming/401733-how-set-datarange-pivot-table.html)

M Carman

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


All times are GMT +1. The time now is 01:38 PM.

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