Thread: VLookup in VBA
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default VLookup in VBA

Set lookuprng = Workbooks("PRProc").Sheets("Accounts").Range("A1:F 65000")

Why not just use whole columns

Set lookuprng = Workbooks("PRProc").Sheets("Accounts").Range("A:F" )



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Mike H." wrote in message
...
I am trying to use the Vlookup function in VBA and the lookup is to an
external workbook. I get a runtime Error 9 when setting the lookup range:

Set lookuprng =
Workbooks("PRProc").Sheets("Accounts").Range("$a$1 :$f$65000")

Actually, my reference is a named range so I'd rather refer to the name
instead, but not sure the syntax for that either:
Set lookuprng = Workbooks("PRProc").Sheets("Accounts").Range("PRLU Rng")