On compilation, I get a syntax error on the line On Error GoTo ErrorHandler
"Near Column 15" which is the beginning of GoTo
. I also tried adding a colon to the end of the line (On Error GoTo ErrorHandler:
) as I've seen some people do, and I get the same error. What is the syntax error that I'm missing?
Subroutine:
Sub HandleAnError()
On Error GoTo ErrorHandler
Dim X
X = 1/0
Exit Sub
ErrorHandler:
MsgBox "Error " & Err.Number & ": " & Err.Description
End Sub