View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Check inputbox enter is in correct format

Surely the format isn't important, just whether it is a date or not

Dim ans
ans = InputBox("Please supply date")
If IsDate(ans) Then
Range("A1").Value = Format(ans, "dd/mm/yy")
Else
MsgBox "Invalid date"
End If


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"mcphc" wrote in message
...
How do I check if a users entry into an inputbox is of the format

dd/mm/yyyy.

It would be sufficient to just check that the first 2 characters are
numbers, the third is "/" the fifth and sixth are numbers, etc.