简体   繁体   中英

Can you use AutoFill without specifying a range?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM