In Excel visual basic - Need an "auto adjusting" fill down macro

C

cdj-work

I need to create a macro that will copy (fill) down the contents of cells A2,
B2, C2 based on the populated rows in column D. For instance if rows 2:15 in
column D have values, then I want contents of A2 copied down to A3:A15, B2 to
B3:B15, C2 to C3:C15. If the next time I run the macro rows 2:45 in column D
have values, then the fill down should adjust to A3:A45, B3:B45, C3:C45, etc.

I have very little experience in visual basic, mostly "tweaking" a few
macros that were created via the Excel Macro Recording Function. I can not
figure out how to create an auto adjusting macro to fill down.
 
G

Gord Dibben

Sub Auto_Fill()
Dim Lrow As Long
With ActiveSheet
Lrow = Range("D" & Rows.Count).End(xlUp).Row
Range("A2:C" & Lrow).FillDown
End With
End Sub


Gord Dibben MS Excel MVP
 

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