-
Solved: VLOOKUP
Hi,
I know how to use VLOOKUP function in EXCEL.
I am looking to learn that how I can use it in VBA as
[VBA]
(1) Worksheetfunction
or
(2) UDF[/VBA]
For example,
A25:A50 contains ProductID
B25:B50 contains ProductName
How can I use VLOOKUP or similar function in VBA to find ProductName, if I have ProductID available?
-
[vba]
Dim cell As Range
On Error Resume Next
Set cell = Range("A25:A50").Find("productid")
On Error GoTo 0
If Not cell Is Nothing Then
MsgBox cell.Offset(0, 1).Value2
End If
[/vba]
-
Thanks. It solved this problem.