Pivot Table Macro with dynamic source data

  • Thread starter Thread starter Corrie
  • Start date Start date
C

Corrie

We've upgraded to Excel 2010. In past macros, I've been able to make
a pivot table dynamic with this script (below) and swapping out the
set range for Range(A1).

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase,
SourceData:= _
Range("A1").CurrentRegion.Address).CreatePivotTable
TableDestination:="", TableName:= _
"PivotTable3", DefaultVersion:=xlPivotTableVersion10


Now the script is different with

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase,
SourceData:= _
"DL!R1C1:R163C16",
Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Sheet4!R3C1", TableName:="PivotTable2",
DefaultVersion _
:=xlPivotTableVersion10

If I add Range ("A1"), in place of "DL!R1C1:R163C16" I get an error
message. Any ideas?
 
Can you post the exact code you're getting the error with, and the
number+text of the error?

Tim
 
Back
Top