Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Formatting
Is there a way to specify that a Date format can only be
in MM-DD-YY, not MM/DD/YY? If Answer = "" Then Exit Sub If Not IsDate(Answer) Then MsgBox "Invalid Date!" Exit Sub End If This will confirm that it is a date, but won't distinguish between / and -. Thanks S. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Formatting
Maybe something like this?
Sub Test() Dim Answer As String Answer = Trim(InputBox("Enter date in DD-MM-YY format")) If Answer = "" Then Exit Sub If Not IsDate(Answer) Then MsgBox "Invalid Date!" Exit Sub End If If Mid(Answer, 3, 1) < "-" Or _ Mid(Answer, 6, 1) < "-" Or Len(Answer) < 8 Then MsgBox "You must use 2 digits for day, month and year" _ & " and you must use hyphen (-) as the separator" Exit Sub End If End Sub -- HTH, Dianne In , S. S. typed: Is there a way to specify that a Date format can only be in MM-DD-YY, not MM/DD/YY? If Answer = "" Then Exit Sub If Not IsDate(Answer) Then MsgBox "Invalid Date!" Exit Sub End If This will confirm that it is a date, but won't distinguish between / and -. Thanks S. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
conditional formatting for cell date to equal today's date | Excel Worksheet Functions | |||
Date Formatting (*) | Excel Discussion (Misc queries) | |||
Formatting the date | Excel Discussion (Misc queries) | |||
XML Date formatting | Excel Discussion (Misc queries) | |||
date formatting | Excel Discussion (Misc queries) |