Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default The On Error Error

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default The On Error Error

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default The On Error Error

You had an alternate suggestion at your first post.

Nick Shinkins wrote:

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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Counting instances of found text (Excel error? Or user error?) S Davis Excel Worksheet Functions 5 September 12th 06 04:52 PM
Automation Error, Unknown Error. Error value - 440 Neo[_2_] Excel Programming 0 May 29th 04 05:26 AM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


All times are GMT +1. The time now is 04:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"