#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default 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/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default 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/

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
Validation (Drop down list vs simple text length validation) Bob Phillips[_6_] Excel Programming 2 April 27th 04 07:47 PM
Validation (Drop down list vs simple text length validation) Jason Morin[_2_] Excel Programming 1 April 27th 04 04:56 PM
Validation (Drop down list vs simple text length validation) Pete McCosh Excel Programming 0 April 27th 04 03:49 PM


All times are GMT +1. The time now is 02:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"