#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default input box

Hi, Can you advise me how to use an input box for Dates only. Id like
the user to Input a date only as dd/mm/yyyy. If anything else entered,
or format wrong to tell user to try again. When date entered, to use
that information to search the workbook for the date, also to have a
msgbox apear to advise the month that has been entered. eg 20/09/2005 -
you have entered SEPTEMBER as your month. I hope this is not asking to
much.
Regards robert

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default input box

Hi Robert

How would you react to a program that rejected a perfectly normal date entry
beause you didn't use / as separators or only entered a two digit year ?
Don't be surprised if your users hate it and refuse to use it. By all means,
I'd like the users to do only the right things too, but they won't, and we
should assist them, not nag them.

Please reconsider and rephrase your goal to "how can I ensure that only a
valid date is entered into an inputbox ?". Here's a solution to that:

Sub MakeDate()
Dim D As Date
Dim S As String
Do
S = InputBox("Your date:", , S)
If S = "" Then Exit Sub
Loop Until IsDate(S)
D = DateValue(S)
MsgBox "You entered " & Format(D, "dd/mm/yyyy")
End Sub

It accepts all common date formats according to the computer's regional
settings. If you want it to accept an entry like 20092005 as well then you
must do some additional coding, it is also worth doing.

HTH. Best wishes Harald

skrev i melding
oups.com...
Hi, Can you advise me how to use an input box for Dates only. Id like
the user to Input a date only as dd/mm/yyyy. If anything else entered,
or format wrong to tell user to try again. When date entered, to use
that information to search the workbook for the date, also to have a
msgbox apear to advise the month that has been entered. eg 20/09/2005 -
you have entered SEPTEMBER as your month. I hope this is not asking to
much.
Regards robert



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default input box

Harald
Thankyou for replying. A very good point, hadnt looked at it that way,
taken on board though.
Regards Robert

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 to input pictures automatically based on cell input? bsharp Excel Worksheet Functions 9 May 30th 09 07:16 AM
input in number form is being multiplied by 1000 when i input. jweinograd Excel Discussion (Misc queries) 4 April 16th 07 11:18 PM
How do I add input data in the input ranges in drop down boxes. oil_driller Excel Discussion (Misc queries) 1 November 9th 05 10:31 PM
=SUMIF(Input!H2:H718,AZ19,Input!E2:E685)AND(IF ALex Excel Worksheet Functions 2 March 14th 05 09:19 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 12:21 PM.

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"