Vlookup in a Macro

S

Spinz

Hi

I have the following vlookup formula and wish to insert this into a macro

the worksheet has the vlookup field in column "e" with month by month data
going across in columns - these will be updated monthly from a downloaded csv

the vlookup looks like this

VLOOKUP(RC[-11],'Filename'!R33C3:R84C12,10,0

-11 = column e

Does anyone know how i can make this formulae stretch down as far as i need
it to go down ?

Thanks in advance
 
R

royUK

Something like this, note it is filling D11 down.


Code:
--------------------
Dim rFormulas As Range
With Sheet1 '<change this to suit
Set rFormulas = .Range(.Cells(11, 4), .Cells(.UsedRange.Rows.Count, 4))
rFormulas.Formula = "=VLOOKUP(RC[-11],'Filename'!R33C3:R84C12,10,0)"
End With
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
 
Top