ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   on error coding (https://www.excelbanter.com/excel-programming/436071-error-coding.html)

Matthew Dyer

on error coding
 
Could someone please give me a brief overview of how the 'on error'
code works? what different kinds of things can I do with it? Do I
place it before code that may return an error or after?

Otto Moehrbach[_2_]

on error coding
 
It's not a matter of before or after. It's bracketing your action code with
the On Error code. Before the code that you thing might error out, write
something like "On Error Resume Next". With this line you have said "Don't
EVER stop on ANY error". Obviously, you don't want that. You just want to
trap the possible error within a small bit of your code. After your code
has dealt with the error you want a line like "On Error GoTo 0". That
returns the error detection system back to normal. Does this help? Otto

"Matthew Dyer" wrote in message
...
Could someone please give me a brief overview of how the 'on error'
code works? what different kinds of things can I do with it? Do I
place it before code that may return an error or after?



Matthew Dyer

on error coding
 
On Nov 11, 3:35*pm, "Otto Moehrbach"
wrote:
It's not a matter of before or after. *It's bracketing your action code with
the On Error code. *Before the code that you thing might error out, write
something like "On Error Resume Next". *With this line you have said "Don't
EVER stop on ANY error". *Obviously, you don't want that. *You just want to
trap the possible error within a small bit of your code. *After your code
has dealt with the error you want a line like "On Error GoTo 0". *That
returns the error detection system back to normal. *Does this help? *Otto

"Matthew Dyer" wrote in message

...



Could someone please give me a brief overview of how the 'on error'
code works? what different kinds of things can I do with it? Do I
place it before code that may return an error or after?- Hide quoted text -


- Show quoted text -


that acutally does help. I found a really good online tutorial for on
error coding written by chip pearson who you've probably seen around
these groups. I highly reccomend anyone who has any questions about on
error coding to check it out.
http://www.cpearson.com/excel/ErrorHandling.htm


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

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