autofill empty cells with a macro in excel

G

Guest

I have a macro set-up to copy information into columns A:K. This information
will change each time. There is a formula in L,M and N. I would like a macro
that would copy the formulas down to the final row of the info in column K.
Any suggestions?
 
G

Guest

Assume the formulas are in row 1

Sub ABC()
Dim rng as Range
Set rng = Cells(Rows.Count, "K").End(xlUp)
Range("L1:N1").AutoFill Range("L1:N1").Resize(rng.Row, 3)
End Sub
 
G

Guest

Thanks Tom. That worked but is seems to copy the formula to one extra row.
Not a big deal. I'm just curious why.
 
G

Guest

I am unable to figure this out. I have headers in row one. The formulas I
need copied don't start until row 2. Thanks!
 
M

Mike Fogleman

Sub ABC()
Dim rng As Range
Set rng = Cells(Rows.Count, "K").End(xlUp)
Range("L2:N2").AutoFill Range("L2:N2").Resize(rng.Row - 1, 3)
End Sub


Mike F
 
G

Guest

Thanks Mike! I was trying to adjust the range. You just made my morning.
And quite possibly my whole week!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top