[VBA]Input validation format dd/mm/yyyy
Solved
lml-mike
Posted messages
449
Registration date
Status
Contributor
Last intervention
-
lml-mike Posted messages 449 Registration date Status Contributor Last intervention -
lml-mike Posted messages 449 Registration date Status Contributor Last intervention -
Hello,
I simply want to perform input validation on an input box, which indicates an incorrect entry if:
- The date is not in the format dd/mm/yyyy
- The date is later than today's date
That's all :)
Thank you for your help!
Mike.
I simply want to perform input validation on an input box, which indicates an incorrect entry if:
- The date is not in the format dd/mm/yyyy
- The date is later than today's date
That's all :)
Thank you for your help!
Mike.
2 answers
Hello,
A lead:
;o)
--
«What is well conceived is clearly stated, And the words to express it come easily.»
Nicolas Boileau
A lead:
Sub testSaisieDate() Dim rep As String rep = InputBox("Enter the date") If Not IsDate(rep) Then MsgBox "This is not a date format" test End If If CDate(rep) > Date Then MsgBox "The date must be before today's date" test End If If rep <> Format(rep, "dd/mm/yyyy") Then MsgBox "the format must be dd/mm/yyyy" test End If End Sub ;o)
--
«What is well conceived is clearly stated, And the words to express it come easily.»
Nicolas Boileau