W
will-d
Dear Experts,
I have an existing pivot table named PivotTable2 in sheet "summary" and its
source in another sheet "Data" in same workbook. "Data" always changes, The
row and columne number in "Data" are two calculated results stored in
variable lrow2 and lcol2.
I would like to keep the layout and location of PivotTable2 in "Summary"
sheet but only change the data source range in sheet "Data". I am using excel
2002 and the folowing code does not work.
Sheet("Data").Activate
Dim mysource2 as Range
With ActiveSheet
Set mysource2 = .Range(.Cells(1, 1), .Cells(lrow2, lcol2))
End With
Sheets("Summary").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:=mysource2
How do I change a range of an existing Pivot Table without changing anyother
settings?
Thanks!
I have an existing pivot table named PivotTable2 in sheet "summary" and its
source in another sheet "Data" in same workbook. "Data" always changes, The
row and columne number in "Data" are two calculated results stored in
variable lrow2 and lcol2.
I would like to keep the layout and location of PivotTable2 in "Summary"
sheet but only change the data source range in sheet "Data". I am using excel
2002 and the folowing code does not work.
Sheet("Data").Activate
Dim mysource2 as Range
With ActiveSheet
Set mysource2 = .Range(.Cells(1, 1), .Cells(lrow2, lcol2))
End With
Sheets("Summary").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:=mysource2
How do I change a range of an existing Pivot Table without changing anyother
settings?
Thanks!