InputBoxes Exceptions

I

ianripping

How do I make an error report appear if characters are entered into a
input box rather than numbers and vicer versa
 
T

Tom Ogilvy

num = Application.Inputbox("Enter Numbers:", type:=1)

A number can be text, so not sure what you mean about the vicer versa.
 
I

ianripping

This is perfect, can it be done so that if i ask for a letter and
number is inputted, a simillar error will appear
 
T

Tom Ogilvy

As I said, a number can be part of a string, so you can't do it with built
in functionality. You can have something like:

Sub AAAATester1()
Do
res = Application.InputBox("enter string", Type:=2)
If IsNumeric(res) Then MsgBox "no numbers"
Loop While Not IsNumeric(res)
End Sub
 
Top