Apply conditions on Input box continuation!

A

aiyer

Hi all!

Thanks for the tips.
Well I tried them but here'z the problem.

I tried the following with the intention of letting the user type i
ONLY numeric values as the Input.
==============================================
Sub MF ()
MyNum = InputBox("Enter the area multiplication factor")

If Not IsNumeric(MyNum) Then
MsgBox "Invalid Entry! The multiplication factor entered is not
numeric. "

Exit Sub

endif

end sub
==============================================


But when the 'Cancel' or 'OK' button are hit, Excel thinks those ar
non-numeric too and displays the very same message above and it simpl
exits of the loop.

I dont want the program to display " Invalid Entry! The multiplicatio
factor entered is not numeric. " when the 'Cancel' or 'OK' button ar
hit. It should simply exit the loop without displaying any message.

Is there a way we can do this?

Thanks again guys.

Regds,
Arun....

Vtec Corp.

p.s:
====
I did try the other options like the following:

mynum = Application.InputBox _
("Enter the area multiplication factor", Type:=1)

Still the same thing.....
 
T

Tom Ogilvy

Sub MF ()
MyNum = InputBox("Enter the area multiplication factor")
if MyNum = "" then exit sub
If Not IsNumeric(MyNum) Then
MsgBox "Invalid Entry! The multiplication factor entered is not numeric. "

Exit Sub

endif
 

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