View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default copy down with variable number of rows

To first blank cell in D or to the last filled cell in D?

This macro will fill to last filled cell in D.

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


Gord Dibben MS Excel MVP

On 14 Nov 2007 14:08:14 -0800, mohavv wrote:

Hi,

I would like to add a copy down function into a macro but the number
of rows varies.

I insert 3 columns A to C and add formulas in the first 3 cells
(A1:C1). These formulas need to be copied down as long as there are
values in colums D (= to the first blank cell in D). Like the auto
fill function.

How can I do this?

With the macro recorder using the autofill it gives me a fixed range.

Cheers,

Harold