Hi All,
I would like to set the VBA codes so that Excel will update the data range and refresh the pivot tables, everytime when the data is copied and paste into a worksheet. The data source worksheet is "CorpStoresSOH"; and the pivot table is in the "CorpStores SOH Summary". It is found that it has Run time 91 error.
can anyone advise what should be the right coding?
Worksheets("CorpStoresSOH").Activate
Range("A3").Select
lastrow = Worksheets("CorpStoresSOH").UsedRange.Rows.Count
Set MB58range = Worksheets("CorpStoresSOH").Range("A3:L" & lastrow)
Worksheets("CorpStoresSOH Summary").PivotTables("pivottable_2").ChangePivotCache ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=MB58range, Version:=xlpivottableversion15)
Thank you so much~~
Best Regards,
joe
I would like to set the VBA codes so that Excel will update the data range and refresh the pivot tables, everytime when the data is copied and paste into a worksheet. The data source worksheet is "CorpStoresSOH"; and the pivot table is in the "CorpStores SOH Summary". It is found that it has Run time 91 error.
can anyone advise what should be the right coding?
Worksheets("CorpStoresSOH").Activate
Range("A3").Select
lastrow = Worksheets("CorpStoresSOH").UsedRange.Rows.Count
Set MB58range = Worksheets("CorpStoresSOH").Range("A3:L" & lastrow)
Worksheets("CorpStoresSOH Summary").PivotTables("pivottable_2").ChangePivotCache ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=MB58range, Version:=xlpivottableversion15)
Thank you so much~~
Best Regards,
joe