Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Error trapping & Handling

I am trying to do the following;

I want to close without saving all open workbooks that are currently opn and
happen to match a list in an array.

I want to "On Error" drop out of an If then or for ..next loop. How the hell
do I accomplish this(I've tried 6 ways to sunday)

I Want to elegantly deal with things like "Worksheet exists" or "Note in
cell already exists"

Thanks in advance I've looked around using Google but I have had no success.
Nobody seems to be interested in errors or giving away the secrets to us Yobs!

Jeff
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Error trapping & Handling

You can drop out of an If-Then construct with a GoTo and a label. You get
out of a For loop with "Exit For".
With the On Error, you can say something like:
On Error GoTo TheOtherPlace. Immediately after the TheOtherPlace label, put
"On Error GoTo 0" to reset the error system. Post back if you need more.
HTH Otto
"Jeff" wrote in message
...
I am trying to do the following;

I want to close without saving all open workbooks that are currently opn
and
happen to match a list in an array.

I want to "On Error" drop out of an If then or for ..next loop. How the
hell
do I accomplish this(I've tried 6 ways to sunday)

I Want to elegantly deal with things like "Worksheet exists" or "Note in
cell already exists"

Thanks in advance I've looked around using Google but I have had no
success.
Nobody seems to be interested in errors or giving away the secrets to us
Yobs!

Jeff



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Error trapping & Handling

Your subs and or functions should look like this...

private sub test()
On Error Goto ErrorHandler

'Your code here...

Exit Sub
ErrorHandler:
'Do that voodoo that you do
'Resume Next 'go back to the last line of regular code executed and
continue at the following line
end sub



"Jeff" wrote:

I am trying to do the following;

I want to close without saving all open workbooks that are currently opn and
happen to match a list in an array.

I want to "On Error" drop out of an If then or for ..next loop. How the hell
do I accomplish this(I've tried 6 ways to sunday)

I Want to elegantly deal with things like "Worksheet exists" or "Note in
cell already exists"

Thanks in advance I've looked around using Google but I have had no success.
Nobody seems to be interested in errors or giving away the secrets to us Yobs!

Jeff

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
Error Trapping gazza67[_2_] Excel Discussion (Misc queries) 2 September 6th 07 06:11 PM
Trapping #VALUE! error RhysPieces Excel Discussion (Misc queries) 6 August 22nd 07 03:13 AM
error trapping flow23 Excel Discussion (Misc queries) 3 April 13th 06 04:51 PM
trapping error RobcPettit Excel Programming 2 January 30th 04 03:37 AM
error trapping libby Excel Programming 5 November 25th 03 10:57 PM


All times are GMT +1. The time now is 03:28 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"