ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   concept of syntax (https://www.excelbanter.com/excel-discussion-misc-queries/163392-concept-syntax.html)

hamed

concept of syntax
 
I'm reviewing some VB codes.I don't undrestand the concept of these two lines:
On Error Resume Next(what is the "next" here?next line of codes or what?
On Error GoTo 0
Any help?
thanks

Chip Pearson

concept of syntax
 
"On Error Resume Next" causes execution to ignore any error and continue
processing on the next line following the line that caused the error. Note
that in no way is the error "fixed" -- it is just ignored, but side effects
may cause other problems. "On Error Goto 0" causes any error to stop the
code in debug mode. When an error occurs, code stops and in the VBA editor
and you'll be sitting on the line in break mode that caused the error to
arise. You can end the code completely, fix the condition that caused the
error, or modify the code to prevent the error. The "Goto 0" doesn't cause
code to "go" anywhere -- it just pauses on the error.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"hamed" wrote in message
...
I'm reviewing some VB codes.I don't undrestand the concept of these two
lines:
On Error Resume Next(what is the "next" here?next line of codes or what?
On Error GoTo 0
Any help?
thanks



Bob Phillips

concept of syntax
 

"Chip Pearson" wrote in message
...
"On Error Resume Next" causes execution to ignore any error and continue
processing on the next line following the line that caused the error. Note
that in no way is the error "fixed" -- it is just ignored, but side
effects may cause other problems. "On Error Goto 0" causes any error to
stop the code in debug mode. When an error occurs, code stops and in the
VBA editor and you'll be sitting on the line in break mode that caused the
error to arise. You can end the code completely, fix the condition that
caused the error, or modify the code to prevent the error. The "Goto 0"
doesn't cause code to "go" anywhere -- it just pauses on the error.


Unless there is an On Error Statement in a parent procedure, in which case
it will branch to that.



hamed

concept of syntax
 
thank you Bob.

"Bob Phillips" wrote:


"Chip Pearson" wrote in message
...
"On Error Resume Next" causes execution to ignore any error and continue
processing on the next line following the line that caused the error. Note
that in no way is the error "fixed" -- it is just ignored, but side
effects may cause other problems. "On Error Goto 0" causes any error to
stop the code in debug mode. When an error occurs, code stops and in the
VBA editor and you'll be sitting on the line in break mode that caused the
error to arise. You can end the code completely, fix the condition that
caused the error, or modify the code to prevent the error. The "Goto 0"
doesn't cause code to "go" anywhere -- it just pauses on the error.


Unless there is an On Error Statement in a parent procedure, in which case
it will branch to that.





All times are GMT +1. The time now is 08:42 PM.

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