VB Formula / Vlookup

D

Dennis

Hi

I'm trying to create a macro that populates a cell in a
worksheet with a vlookup formula, however, the table array
is another workbook and is variable.

here is my code so far...

Let X = Range("factsaccount") & "." & Range("workstation")
Range("NAV") = "=VLOOKUP(""Net Assets"",X$C:$D,2,FALSE)"


Thanks

-Dennis
 
D

Dave Peterson

Maybe this technique will help:

dim myRng as range

set myrng _
= workbooks("otherworkbook").worksheets("otherworksheet").range("c:d")

range("nav").formula = "=vlookup(""net assets""," & _
myrng.address(external:=true) & ",2,false)"

===
But I'm not sure how X fit in.
 
Top