Dokat
asked on
VBA Lookup Problem
Hi,
I have the below code returning Run-Time Error 1004 - Unable to get the Vlookup property of worksheetfunction class error. I noticed issue happens when lookupvalue is not in lookup range. Can anyone help solve this problem?
Here is the code and higlighted line
I have the below code returning Run-Time Error 1004 - Unable to get the Vlookup property of worksheetfunction class error. I noticed issue happens when lookupvalue is not in lookup range. Can anyone help solve this problem?
Here is the code and higlighted line
cl.Offset(, 1) = Application.WorksheetFunction.Vlookup(cl, LookupRange, LookupColNum, ExactMatch)
Sub LookupTier()
Dim LookupRange As Range
Dim LookupValue As Range
Dim cl As Range
Set LookupValue = ActiveSheet.Range("CG:CG")
Set LookupRange = ActiveSheet.Range("DE:DF")
LookupColNum = 2
ExactMatch = False
For Each cl In LookupValue
If cl.Value <> "" Then
cl.Offset(, 1) = Application.WorksheetFunction.Vlookup(cl, LookupRange, LookupColNum, ExactMatch)
On Error Resume Next
On Error GoTo 0
End If
Next cl
End Sub
Topline-05192017.xlsb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER