Is there a way to have VBA just use AutoFill without giving it a range? I tried recording a macro and used the autofill by clicking the small square on the bottom right corner of a cell that held a single number in it to fill the column with the same number down to the same level as the two adjacent columns. The VBA gave me this: Selection.AutoFill Destination:=Range("AV2:AV509")
but I want to be able to use this macro with a different spreadsheet that may have more or fewer cells than AV509
. Is there a VBA function for that?
Asked
Active
Viewed 311 times
-1

Zylo
- 1
-
Sounds like you need to [find the last row](https://stackoverflow.com/questions/11169445/error-in-finding-last-used-cell-in-excel-with-vba). As to your title, no, the *Destination* parameter of [`Range.AutoFill`](https://learn.microsoft.com/en-us/office/vba/api/excel.range.autofill) is required. – BigBen Mar 29 '21 at 17:38
1 Answers
0
You should find the Last Row in the column and save it in a variable Once you have that you can pass that value in the range.

Prashant Chawla
- 1
- 2