Hi All
So after much searching through many posts about how to change the source data of a pivot table, I finally found some code that seems to work for me, but for some reason I keep getting the following error:
I think it may have something to do with the "DataArea" part, but I cannot figure out why!
the data starts in the tab, "1_SOA_-_With_Chat" ,from cell A2 to O9999
Can anyone see what I'm doing wrong?
My thanks for your help in advance!
So after much searching through many posts about how to change the source data of a pivot table, I finally found some code that seems to work for me, but for some reason I keep getting the following error:
Code:
Run-time error '-2147024809 (80070057)':
Cannot open PivotTable source file
'\\xxxxx\me\xxxx'
I think it may have something to do with the "DataArea" part, but I cannot figure out why!
the data starts in the tab, "1_SOA_-_With_Chat" ,from cell A2 to O9999
Code:
Sub Macro1()
Sheets("1_SOA_-_With_Chat").Activate
Range("A2").Select
Selection.Range("A1:O9999").Select
DataArea = "SOA Rec!R1C1:R" & Selection.Rows.Count & "C" & Selection.Columns.Count
Sheets("Pivs").PivotTables("PivotTable1").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:=DataArea, _
Version:=xlPivotTableVersion14)
End Sub
Can anyone see what I'm doing wrong?
My thanks for your help in advance!