当我使用下面的代码更改 VBA 中的数据透视源范围时,我得到“无效的过程或调用”。这样做的正确语法是什么?提前致谢。
Dim DataArea As Variant
'...
DataArea = "Raw_Data!R1C1:R" & Selection.Rows.Count & "C" & Selection.Columns.Count
Sheets("Pivot-view").Select
Range("A1").Select
ActiveSheet.PivotTables("PivotTable1").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:=DataArea, _
Version:=xlPivotTableVersion14)