ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On error goto 0 (https://www.excelbanter.com/excel-programming/282738-error-goto-0-a.html)

David

On error goto 0
 
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

Chip Pearson

On error goto 0
 
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

"David" wrote in message
...
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




Dana DeLouis[_5_]

On error goto 0
 
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

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"David" wrote in message
...
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





All times are GMT +1. The time now is 01:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com