I create monthly reports that vary in the number of rows. What code that should be used in VBA to show the last row for a pivot table? Below is what is existing. It is looking for data in the area of; Access!$A$1:$AJ$19280. Again, each month the row number, 19280, changes. It goes from A to AJ.
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Access!R1C1:R19280C36", Version:=6).CreatePivotTable TableDestination:= _
"Sheet2!R3C1", TableName:="PivotTable1", DefaultVersion:=6
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Access!R1C1:R19280C36", Version:=6).CreatePivotTable TableDestination:= _
"Sheet2!R3C1", TableName:="PivotTable1", DefaultVersion:=6