View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VB Error Codes - where to look?

Ram gave you advice pertinent to VBA errors. The error you are seeing are
Excel Errors.

See my post for information.

You test these type errors with the iserror function

Dim res as Variant
res = Application.VLookup(year, Range("iraTable"), 3)
if iserror(res) then
msgbox "No match found
Else
msgbox "Results is " & res
End if


--
Regards,
Tom Ogilvy

wrote in message
...
I tried it, but the error code seems to be unknown. Here
is the offending line:

Application.VLookup(year, Range("iraTable"), 3)

In debug mode it returns "Error 2042"

when I try to get the error information, I get nothing:
If Err.Number < 0 Then
Debug.Print "Error # " & Str(Err.Number) "-" &
Err.Description


-----Original Message-----
try err.description to get error message corresponding to

the error code.


.