PC Review


Reply
Thread Tools Rate Thread

Adding multiple handling errors

 
 
New Member
Join Date: Apr 2011
Posts: 2
 
      27th Apr 2011
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding multiple menu Items. Problems handling the click events RBAiras Microsoft Outlook VBA Programming 1 6th Apr 2009 08:29 PM
handling #Div/0! errors rockhammer Microsoft Excel Programming 3 28th Jul 2008 06:09 AM
Handling data update errors with multiple tables John Microsoft ADO .NET 0 27th Apr 2008 10:39 PM
Handling data update errors with multiple tables John Microsoft VB .NET 0 27th Apr 2008 10:39 PM
Handling errors =?Utf-8?B?U2hpbHBz?= Microsoft Excel Programming 2 11th Apr 2007 09:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:50 AM.