ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check inputbox enter is in correct format (https://www.excelbanter.com/excel-programming/380597-re-check-inputbox-enter-correct-format.html)

Bob Phillips

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.





All times are GMT +1. The time now is 03:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com