The On Error Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

OK

I have code similar to the following:

Sub Number1()

For K = 1 to 40

Do this

On Error GoTo SkipTable

What would have happened if there had been no error

SkipTable:

Next K

Number2

End Sub

Sub Number2()

For L = 1 to 40

Do this

On Error GoTo SkipChart

What would have happened had there been no error

SkipChart

Next L

End Sub

--------------

This works fine til it reaches the second sub (which is near identical to
the first) and then any errors refuse to be trapped and inconveniently cause
the code to halt.

Any ideas? I'm lost.

TIA!

Nick Shinkins
 
Nick
You told Excel to go to SkipTable when any error is encountered. It
will do that every time thereafter unless you tell it to go back to normal.
You do that with something like:
On Error GoTo 0
Put this line after the line where the error is expected to occur. This
line tells Excel to revert to normal error behavior. HTH Otto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top