Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error Trapping | Excel Discussion (Misc queries) | |||
Trapping #VALUE! error | Excel Discussion (Misc queries) | |||
error trapping | Excel Discussion (Misc queries) | |||
trapping error | Excel Programming | |||
error trapping | Excel Programming |