VLookup Problem

  • Thread starter Thread starter David
  • Start date Start date
D

David

I've got the following code, but it returns "#REF!" into the cell that
I was expecting the value - can anyone tell me what I've done wrong?

I've double checked and it should be finding something in the target
workbook:

----------

Sub Find_Values()
Dim CustNo As String
CustNo = "GB-NAA001"
Address = Application.VLookup(CustNo, Workbooks("2009-05
Server_Utilisation.xls").Sheets("Server_Utilisation").Range("$C$25:$C
$1000"), 3, False)
Range("A1") = Address
End Sub
 
It doesn't like the value "3" in the end of the VLookup command, if I
change it to 1 it works fine but I don't want to return the value I am
looking for - how can I get the value back from the same row but for
columns "I" and "O" etc?
 
Ignore me, of course you have to include in the range the columns you
want returning, sorry to waste your bandwidth, this worked:

Address = Application.VLookup(CustNo, Workbooks("2009-05
Server_Utilisation.xls").Sheets("Server_Utilisation").Range("$C$25:$I
$1000"), 3, False)
 
in the "Immediate" window, out this
? Application.VLookup(CustNo, Workbooks("2009-05
Server_Utilisation.xls").Sheets("Server_Utilisation").Range("$C$25:$C
$1000"), 3, False)

and see what happens.
 
Back
Top