on error coding

  • Thread starter Thread starter Matthew Dyer
  • Start date Start date
M

Matthew Dyer

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?
 
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
 
It's not a matter of before or after.  It's bracketing your action codewith
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






- 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
 
Back
Top