You could use the CurrentRegion property. You could create the name using
this property or perhaps you could identify the pivot table source range
directly with this.
Bill Horton
"cqc" wrote:
Every week I run a macro to create a pivot table, using source data whose
table size varies weekly, coded as follows:
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"Sheet1!WklyTblSz").CreatePivotTable TableDestination:="", TableName _
:="PivotTable2"
Before running the macro, I would go to the source data to change the cell
references for the 'WklyTblSz' worksheet, using INSERTNAMEDEFINE.
Is there code I can use so that the references are adjusted depending on the
last row and column for the weekly input file?
Thanks in advance,
cqc
|