Autofill question

  • Thread starter Thread starter Eric Dreshfield
  • Start date Start date
E

Eric Dreshfield

How do I modify the following statement so that it does
not have a specific range hard-coded ?

Selection.AutoFill Destination:=ActiveCell.Range
("A1:B2498")

I need it to be generic in nature so that it will copy the
formula from the active cells to all rows below where
there is a value in the cell to the left.

Thanks !!
 
Eric

try this:

ActiveCell.AutoFill _
Destination:=Range(ActiveCell, _
ActiveCell.Offset(0, -1).End(xlDown).Offset(0, 1))

Regards

Trevor
 
Trevor has supplied the code requested, but you don't really need a macro if this is all you are doing. The same operation can be
performed by selecting the cell to be copied and double clicking the Auto-Fill handle at the bottom right corner of the cell,
 
Thank you both for your reply....I knew about the double
click, but I am needing the macro to automate a process so
I will give the code that Trevor supplied a try.

Thanks for your help !
 
Back
Top