I copy data from several sheets to one sheet and use that data to create pivot tables. When I record the macro to create the pivot table I go to the sheet with all the data and use Ctrl+Shift+A to select all the data on the sheet for the pivot table. But, as sheets are added to the Excel file, when the macro for the pivot table is run it only collects data that was there when I created the macro and nothing that was added since that time.
ActiveWorkbook.Worksheets("Reports").PivotTables("PivotTable1").PivotCache. _
CreatePivotTable TableDestination:="Reports!R1C4", TableName:="PivotTable3" _
, DefaultVersion:=xlPivotTableVersion12
Sheets("Reports").Select
Cells(1, 4).Select
How can I tell the macro to select everything on the sheet when the data grows?
ActiveWorkbook.Worksheets("Reports").PivotTables("PivotTable1").PivotCache. _
CreatePivotTable TableDestination:="Reports!R1C4", TableName:="PivotTable3" _
, DefaultVersion:=xlPivotTableVersion12
Sheets("Reports").Select
Cells(1, 4).Select
How can I tell the macro to select everything on the sheet when the data grows?