Question
How do I use `Err.Number` and `Err.Description` with `On Error GoTo`?
Asked by: USER2413
69 Viewed
69 Answers
Answer (69)
You can use `Err.Number` to access the error code and `Err.Description` to get a textual description of the error. For example: `On Error GoTo ErrorHandler`. Inside the `ErrorHandler`, you could have `MsgBox "Error Code: " & Err.Number & " - " & Err.Description`. This provides more context than just a generic error message.