Unable to get the VLookup property of the WorksheetFunction class
this issue is that VLOOKUP and other similar function raise an error when no
match is found. Wrap it in an error trap - personally, I do this within a
user defined function so that my error handling doesn't break, but not
everybody likes this ...
ON ERROR RESUME NEXT
result = WorksheetFunction.VLookup(c.Offset(0, 2).Value, rngsStatusdata,
7, False)
ON ERROR GOTO 0
"Ayo" wrote:
How do I go around this runtime error? I tried the following:
If Application.WorksheetFunction.VLookup(c.Offset(0, 2).Value,
rngsStatusdata, 7, False) < " " Then
If Application.WorksheetFunction.VLookup(c.Offset(0, 2).Value,
rngsStatusdata, 7, False) < "#N/A" Then
If Application.WorksheetFunction.VLookup(c.Offset(0, 2).Value,
rngsStatusdata, 7, False) < "#N/A" Then
trueOnAirWS.Range("J" & reportCurrentRow & "") =
Application.WorksheetFunction.VLookup(c.Offset(0, 2).Value, rngsStatusdata,
7, False)
End If
|