Autofill a Column to last row of data


Posted by Maud on July 25, 2000 4:13 AM

I'm looking for a code that will do the following

I paste data from another workbook to the workbook in which want the macro to work.
The Pasted data will vary in size, so that the Row length will change - I have a formula alongside that changes the format.
What I want it to do is Autofill the formula to the last row of the pasted data.

EG copied data A2:D410
Formula in Column E
The formula in Column E will autofill down to E410

Is this possible?

Maud

Posted by Ivan Moala on July 26, 0100 2:28 AM

Re: Dim switch on -Help!


Hi Maud
I think the code in your situation should be;

Sub Q2AutoFillRange()
Dim AutoFillRg As Range

Range("D2").Select
Set AutoFillRg = Range(ActiveCell, ActiveCell.End(xlDown))
Selection.Offset(0, 1).AutoFill Destination:=Range(AutoFillRg.Offset(0, 1).Address)

End Sub

Try this and let me know.

Ivan

Posted by JAF on July 25, 0100 5:00 AM

This is one that I had a problem with a while back. The ever helpful Ivan posted a reply which can be found at: 1904c.html

This worked for what I needed.


JAF

Posted by Maud on July 25, 0100 6:36 AM

Dim switch on -Help!

I think my brain has gone to the setting "Dim" because I looked at the code and tried to use it but it wouldn't work.

Can someone give me instructions on how to use or set up.

Ps Cheers for the site JAF.

Posted by Maud on July 28, 0100 8:13 AM

Thanks

Thanks Ivan!!



Posted by Mike on July 25, 0100 4:07 PM

I tried to use the code and could not get it to work ..... I need start at J2 and autofill to last cell in the column ...

Best regards,
Mike