Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks again, Myrna. Got it working fine now; and I think I
understand error-handling at last. Myrna Larson wrote: If you put it inside the loop, then you also need, inside the loop, a statement that jumps over the error handler code when there is no error. If you don't do that, and you "fall into" the error handler and the latter contains a Resume statement (which it always should), you'll get a "Resume Without Error" error. Assuming that after an error you want to continue with the next iteration of the loop, the correct structure should look like this: Sub .... ' ' ' ' On Error Goto Handler Do 'your code here ResumeHe Loop Handler: 'do what you need to do to process the error Resume ResumeHere End Sub On Thu, 12 May 2005 12:03:38 -0400, Kate wrote: Myrna, thanks for adding that info. And why is that the case (error-handler must be outside of loop)? Do you mean the on error goto statement? I originally did have it out, but then when it didn't work (because I wasn't setting the program back to normal mode), I moved it inside. But there is no processing outside the loop, so why does it matter? Thanks! Myrna Larson wrote: The other thing I noticed was that your error handler was inside your Do/Loop loop. It has to be outside of that loop, and the Resume statement should send it back into a statement inside the loop. On Wed, 11 May 2005 13:26:35 -0400, Kate wrote: Thank you, I didn't understand that. Now it works! Chip Pearson wrote: You need to understand how error handling works. When an error is raised, your code goes to err_do, and VBA is running in "error mode". No other errors can be trapped until you exit error mode and go back in to normal mode. This is done with a Resume, Resume Next, Exit Sub, or End Sub statement. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Overflow Error | Excel Discussion (Misc queries) | |||
Overflow Error | Excel Programming | |||
Overflow error | Excel Programming | |||
Help! Overflow Error 6 | Excel Programming | |||
overflow error | Excel Programming |