简体   繁体   中英

Equivalent of VLookup in VB6

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM