Try it this way. Modify ranges to suit.
Sub makeformulaandfilldown()
lr = Cells(Rows.Count, "b").End(xlUp).Row
Range("e2:e" & lr).Formula = "=vlookup(b2,$c$2:$d$" & lr & ",2,false)"
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"katamy" <(E-Mail Removed)> wrote in message
news:6B34006A-27E0-4525-9CE4-(E-Mail Removed)...
> I’m working in Excel 2003. I have a report which runs in another program
> that
> I save in Excel. I then create a macro to insert columns at various places
> and perform a vlookup. The data varies each time the report is run. I know
> there is a code that will allow me to AutoFill down to the last row of
> that
> column, but I can’t remember how to do it. Any suggestions?
>
> Here is the code…
>
> Range("X2").Select
> ActiveCell.FormulaR1C1 = _
> "=VLOOKUP(RC[-1],'[Look up Vince
> report.xls]Function'!C1:C2,2,FALSE)"
> Selection.AutoFill Destination:=Range("X2:X2649")
> Range("X2:X2649").Select
>
> Thanks in advance for your help!