PDA

View Full Version : Solved: On Error Help



black02ss
03-12-2005, 08:46 PM
I am trying to get this to work and for some reason can't figure it out. If there is an error I want the sub to end/exit. I am implimenting a msg box as well and I can get it to work partially. The msg box is displayed but you have to click ok 20 times before it will close... I want it to display the box once and thats it.. LOL I can use the on error resume next, but like I said, it shows the msg box too many times.. Any ideas?

Jacob Hilderbrand
03-12-2005, 08:57 PM
You can try something like this:


Sub Macro1()

'Your Variable Declarations Here

On Error Goto ErrorHandler:

'Your Code Here

On Error Goto 0

Exit Sub

ErrorHandler:

MsgBox "There was an error blah blah blah..."

End Sub

black02ss
03-12-2005, 10:24 PM
Thank you very much!!

Jacob Hilderbrand
03-13-2005, 02:50 AM
You're Welcome :beerchug:

Take Care

black02ss
03-13-2005, 02:57 AM
If you could assist me on my other problem that would be WONDERFUL!! I am about to pull my hair out with it.

Jacob Hilderbrand
03-13-2005, 03:02 AM
What's the problem?

black02ss
03-13-2005, 03:12 AM
Your already there.. Thanks!!