Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Force users to enter a range of cell in dd/mm/yy hh:mm format

I have created a template which is filled by users for date & time. Since
users are novice, can I force users to enter the cell values only in
dd/mm/yy hh:mm format?

For ex if a user wants to enter 10th May 09 10:00Am & by mistake he types
10/5/09 10.00 ( uses . instead of colon) excel misunderstands.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Force users to enter a range of cell in dd/mm/yy hh:mm format

The only way that I can think of to be sure the date is the correct format,
is to set up a UserForm with a ListBoxes for Year, Month and Day of Month,
that the user selects from and then have code that transefers the value of
their selection to the worksheet range that has the format you want to use.
This might be more than you wanted to do.


"TATA STEEL" wrote in message
...
I have created a template which is filled by users for date & time. Since
users are novice, can I force users to enter the cell values only in
dd/mm/yy hh:mm format?

For ex if a user wants to enter 10th May 09 10:00Am & by mistake he types
10/5/09 10.00 ( uses . instead of colon) excel misunderstands.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,104
Default Force users to enter a range of cell in dd/mm/yy hh:mm format

You could use Date | Validate since 10/5/09 10:00 is a valid 'date' while
10/5/09 10.00 is not
The Validation dialog requires you enter start and end date but you can
enter some dummy values if this is unimportant to you
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"TATA STEEL" wrote in message
...
I have created a template which is filled by users for date & time. Since
users are novice, can I force users to enter the cell values only in
dd/mm/yy hh:mm format?

For ex if a user wants to enter 10th May 09 10:00Am & by mistake he types
10/5/09 10.00 ( uses . instead of colon) excel misunderstands.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Force users to enter a range of cell in dd/mm/yy hh:mm format

If you input as a string, you can completely validate the format of the input:

Sub GetInput()
Dim s As String
s = Application.InputBox(Prompt:="give me data", Type:=2)
If s Like "##[/]##[/]##[ ]##[:]##" Then
MsgBox ("O.K.")
Else
MsgBox ("N.G.")
End If
End Sub

Note this only checks that the pattern is corrrect.

You can add additional checks, like is the month between 01 and 12
or
is the day between 01 and 31
or
is the hour between 01 and 12
or
is the minute between 00 and 59

If all is good, you can convert the string into a date/time.
If all is not good, prod the user into making another entry.
--
Gary''s Student - gsnu200855


"TATA STEEL" wrote:

I have created a template which is filled by users for date & time. Since
users are novice, can I force users to enter the cell values only in
dd/mm/yy hh:mm format?

For ex if a user wants to enter 10th May 09 10:00Am & by mistake he types
10/5/09 10.00 ( uses . instead of colon) excel misunderstands.



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
how do i force users to first enter data in one cell before anythi des-sa[_2_] Excel Discussion (Misc queries) 2 June 3rd 08 10:29 PM
Force user to enter data in cell before moving to next cell Fusionmags New Users to Excel 3 November 19th 06 11:49 PM
Making sure users enter phone numbers in a particular format Amber_D_Laws[_65_] Excel Programming 11 February 8th 06 09:51 PM
How to force <enter to behave like <alt + <enter within a cell luckyinky Excel Programming 3 July 28th 05 04:47 PM
Not allowing users to enter data into certain cells if another cell is empty KimberlyC Excel Programming 12 May 6th 05 06:19 PM


All times are GMT +1. The time now is 09:38 AM.

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

About Us

"It's about Microsoft Excel"