On error goto 0

  • Thread starter Thread starter David
  • Start date Start date
D

David

Greetings,
I know that the above has the effect of cancelling 'on
error resume next' but could someone please explain in a
little more detail for my education.
David
 
David,

On Error Goto 0 simply turns off error handling, and any error that occurs
will raise a run time error and cause the error message box to display.
Despite the "Goto" in the statement, it doesn't cause code to branch to any
statement.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
In the old days (before my time of course...) code use to have line numbers
as labels. You can still use line numbers today, but it is not often used.
Going to a line number of zero was the way to turn this off. Line Labels of
text is of course is still used ( On Error GoTo MyErrorHandel). I think
that maybe the "GoTo 0" part could use a little updating in the future.

Sub Demo()
10 Dim a
20 On Error Resume Next
30 a = 2
40 a = a / 0

50 On Error GoTo 0

End Sub
 
Back
Top