copying formula to a randow row

  • Thread starter Thread starter Ole
  • Start date Start date
O

Ole

I want to use the autofill to copy a formula
by using a macro. When I register the macro VBA suggests ie
Selection.AutoFill Destination:=Range("C1:C8")

but I don't want to predetermine how long the range is to be, because it can
vary from 100 to 25000 rows, and I want the copy function to stop at the
last cell that has a value to the left.

Thanks Oystein (Norway)
 
Hi
try something like

lastrow = Activesheet.Cells(Rows.Count,"B").End(xlUp).Row
Selection.AutoFill Destination:=Range("C1:C" & lastrow)
 
Back
Top