1

How can I make a macro in excel to select all active cells when the rows on the data source changes on a daily basis. When the macro was recorded, I press Ctrl+A to select all active cell, it did it when the macro was originally recorded but when the macro runs with different data rows it only selects what was memorized when recorded and the current active cells. Unfortunately to temporary fix this I have to manually change the source data and refresh.

This is the Macro I got after it was recorded

Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    "Sheet1!R1C1:R3357C15", Version:=6).CreatePivotTable TableDestination:= _
    "Sheet4!R3C1", TableName:="PivotTable1", DefaultVersion:=6
Sheets("Sheet4").Select
Cells(3, 1).Select
Hiram
  • 11
  • 1
  • [Don't use `.Select`/`.Activate`](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba). Do you just want to get all the data on a sheet? Look in to getting the last row and last column of a worksheet. Does it have headers? – BruceWayne Jan 03 '20 at 20:57
  • [This question](https://stackoverflow.com/questions/11169445/error-in-finding-last-used-cell-in-excel-with-vba) should be very helpful. – BigBen Jan 03 '20 at 21:03
  • Yes it has it has headers and is raw data extract to excel then I run the recorded macro. – Hiram Jan 03 '20 at 22:05

0 Answers0