tags:

views:

39

answers:

1

Dear All, I want to use the vlookup function in VB6. what is the code for it? I am currently using this code:

WorkSheetName.Application.VLookup(20,WorkSheetName2.Range("A2:B20").Address,2,False)

WorkSheetName2 contains the lookup table. WorkSheetName is the sheet that contains a list of values to be looked up for their corresponding values from the lookup. 20 is an example of the value that I want to return its corresponding value from the lookup table. The above code did not work. It returns empty. I also tried the following:

WorkSheetName.Application.WorksheetFunction.Vlookup(20,WorksheetName.Range("A2:B20").Address,2,False)

This gave me an error and can't execute it. Please guide me.

+1  A: 
WorkSheetName.Application.WorksheetFunction.Vlookup( _
   20, WorkSheetName2.Range("A2:B20"), 2, False)
GSerg
Thank you sooooooooooooo much! It worked :). You are the king ;)
guest1