ThrottleWorks
Excel Ninja
Hi,
I am trying to assign a range to a Pivot table and refresh it.
I have recorded the below mentioned code and edited "SourceData:= _''' \\aaa\aaa\aaa\aaa\aaa\aaa\My Documents\aaa\aaa\aaa\aaa\[aaa.xls]Data R1C1:R20C26"
part with SourceData:=Amendrng. However this is resulting in bug.
The Amendrng is a valid range. I checked the address in immediate window.
Data range is in sheet 2 and Pivot table is in sheet 1 of the same file.
I am not able to understand the problem, can anyone please help me with this.
I am trying to assign a range to a Pivot table and refresh it.
I have recorded the below mentioned code and edited "SourceData:= _''' \\aaa\aaa\aaa\aaa\aaa\aaa\My Documents\aaa\aaa\aaa\aaa\[aaa.xls]Data R1C1:R20C26"
part with SourceData:=Amendrng. However this is resulting in bug.
The Amendrng is a valid range. I checked the address in immediate window.
Data range is in sheet 2 and Pivot table is in sheet 1 of the same file.
I am not able to understand the problem, can anyone please help me with this.
Code:
''' ActiveSheet.PivotTables("PivotTable2").ChangePivotCache ActiveWorkbook. _
''' PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
''' "\\aaa\aaa\aaa\aaa\aaa\aaa\My Documents\aaa\aaa\aaa\aaa\[aaa.xls]Data R1C1:R20C26" _
''' , Version:=xlPivotTableVersion10)
Code:
ActiveSheet.PivotTables("PivotTable2").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Amendrng, Version:=xlPivotTableVersion10)