Autofill question

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 !!
 
T

Trevor Shuttleworth

Eric

try this:

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

Regards

Trevor
 
J

John Green

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,
 
E

Eric Dreshfield

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 !
 

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

Similar Threads

Autofill Dynamic Range of Cells 2
Autofill with Column as a variable 5
Autofill problem 2
Autofill range 2
Coding problem 2
Autofill variable range 2
Error 1004 - Autofill 3
AutoFill on selection 5

Top