Link to home
Start Free TrialLog in
Avatar of Edward Pamias
Edward PamiasFlag for United States of America

asked on

Macro to autofill to the last row.

I created a macro to autofill to the last row but it does not work correctly. I looked up a few other macros and they did not work for me either. Can someone take a look at this macro I made and see what changes I need, to make it go to the last row. Thanks!
Sub fill()

Range("N2:R2").Select
Selection.Autofill Destination:=Range("N2:R16586")
Range("N2:R16586").Select
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Edward Pamias

ASKER

This worked perfectly! Thank you!
Assuming you have data in column M all the way down, you don't need a macro.

Select cells N2:R2 and then hover the cursor over the bottom right corner of R2, the cursor will change to a bold + symbol.  Double click and it will fill down columns N to R as far as there is data in column M.

Thanks
Rob H
Thanks Rob! I was being lazy and wanted a quick way of doing it. Look out for my next question. Coming soon! You have been a big help.
Highlight and double-click can't be much slower. Also advantage of using non-VBA procedures is that they can be undone.

When you run a macro, it clears the Undo history.
Thanks Rob! I will remember that for the future. My other question is out there and I know you are going to say didn't I ask this already. The answer is no.... this is a bit different.