saloelrn1988
New Member
- Joined
- Apr 14, 2020
- Messages
- 32
- Office Version
- 365
- Platform
- Windows
hi ,
I wanted to change the pivot table source data base on a specific tab and cell name. I tried recording it and see below code:
Sub Chnage_data_source()
'
' Chnage_data_source Macro
'
'
Range("BG1").Select
ActiveSheet.PivotTables("PivotTable1").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"C:\Users\elron\Desktop\improvement\Payments\[Payment run Template_V3.xlsm]Template (2)'this is the change that I made!C2:C52" _
, Version:=6)
Range("BO1").Select
ActiveSheet.PivotTables("PivotTable6").ChangePivotCache ("PivotTable1")
End Sub
I wanted to change the pivot table source data base on a specific tab and cell name. I tried recording it and see below code:
Sub Chnage_data_source()
'
' Chnage_data_source Macro
'
'
Range("BG1").Select
ActiveSheet.PivotTables("PivotTable1").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"C:\Users\elron\Desktop\improvement\Payments\[Payment run Template_V3.xlsm]Template (2)'this is the change that I made!C2:C52" _
, Version:=6)
Range("BO1").Select
ActiveSheet.PivotTables("PivotTable6").ChangePivotCache ("PivotTable1")
End Sub