ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validation (https://www.excelbanter.com/excel-programming/307513-validation.html)

halem2[_10_]

Validation
 
I need to validate what the user inputs in a specific cell. I have se
validation on that cell for Whole numbers to avoid having the user typ
letters and it works fine but when I run the macro that promts the use
for the number, validation does not work.

How can I have the macro validate that the input is a whole number
with 5 characters and there's no letters?

thanks one more tim

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


GJones

Validation
 
Hi Halem2;

Use this:

Sub try()



Dim Message, Title, Default, MyValue
Message = "Enter a number that has 5 characters" ' Set
prompt.
Title = "InputBox Demo" ' Set title.
Default = "12345" ' Set default.

' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)

If Not IsNumeric(MyValue) Or Not Len(MyValue) = 5 Then
MsgBox "you can't do that"

End If





End Sub


Thanks Greg






-----Original Message-----
I need to validate what the user inputs in a specific

cell. I have set
validation on that cell for Whole numbers to avoid having

the user type
letters and it works fine but when I run the macro that

promts the user
for the number, validation does not work.

How can I have the macro validate that the input is a

whole number,
with 5 characters and there's no letters?

thanks one more time


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

.


K Dales

Validation
 
Validated = (ActiveCell.Value like "#####")

-----Original Message-----
I need to validate what the user inputs in a specific

cell. I have set
validation on that cell for Whole numbers to avoid having

the user type
letters and it works fine but when I run the macro that

promts the user
for the number, validation does not work.

How can I have the macro validate that the input is a

whole number,
with 5 characters and there's no letters?

thanks one more time


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

.



All times are GMT +1. The time now is 06:44 AM.

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