ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   InputBoxes Exceptions (https://www.excelbanter.com/excel-programming/294455-inputboxes-exceptions.html)

ianripping[_42_]

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

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

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

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

--
Regards,
Tom Ogilvy


"ianripping " wrote in message
...
How do I make an error report appear if characters are entered into an
input box rather than numbers and vicer versa?


---
Message posted from http://www.ExcelForum.com/




ianripping[_43_]

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

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

InputBoxes Exceptions
 
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

--
Regards,
Tom Ogilvy

"ianripping " wrote in message
...
This is perfect, can it be done so that if i ask for a letter and a
number is inputted, a simillar error will appear?


---
Message posted from http://www.ExcelForum.com/





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com