Adding multiple handling errors

Joined
Apr 27, 2011
Messages
2
Reaction score
0
Hi

Just did a crash course on excel macro programming, but still got a lot to learn.

Basiclly, I want to insert 2 handling errors in the subroutine. I have the first handling error working fine, but when the second error activate, the code doesn't move down to the next handling error.

My current macro work is quite long, so I did a simpler one to gain better understanding.

senario is if I enter a letter rather than a number for the first input box, the error handler will activate (E1), works fine.... it will go back to step1, but when I enter a letter in the second input box, the error handler (E2) won't activate... debugging line highlight on inputext = InputBox("enter a number")


appreciate for your help.

kind regards

Louis
=============================================
Sub test()
On Error GoTo e1
Dim inpnumber As Long
Dim inpuresult As Long
Dim inputext As Long


step1:

ingnumber = InputBox("enter number")


inpuresult = ingnumber + 2
On Error GoTo e2

inputext = InputBox("enter a number")

MsgBox (inputext * inpuresult)
Exit Sub


e1:

MsgBox " That's not a number, try again"
GoTo step1
Exit Sub

e2:
MsgBox "try again"


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top