Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to input pictures automatically based on cell input? | Excel Worksheet Functions | |||
input in number form is being multiplied by 1000 when i input. | Excel Discussion (Misc queries) | |||
How do I add input data in the input ranges in drop down boxes. | Excel Discussion (Misc queries) | |||
=SUMIF(Input!H2:H718,AZ19,Input!E2:E685)AND(IF | Excel Worksheet Functions | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming |