ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use "VLookup" function (https://www.excelbanter.com/excel-programming/286480-use-vlookup-function.html)

Grey

Use "VLookup" function
 
i want to know that how to use "VLookup" function in VBA?

wolf

Use "VLookup" function
 
There is plenty of informationin the Excel help

-----Original Message-----
i want to know that how to use "VLookup" function in VBA?


Tom Ogilvy

Use "VLookup" function
 
dim target as Range
Dim lookRange as Range
Dim res as Variant

Set target = Range("A1")
Set lookRange = worksheets("Sheet2").Range("A1:F300")

res = Application.Vlookup(Target,lookRange,2,False)
if iserror(res) then
' not found
else
msgbox "Result is " & res
End if


--
Regards,
Tom Ogilvy


"Grey" wrote in message
...
i want to know that how to use "VLookup" function in VBA?




All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com