Hello!
I'm trying to find a way to verify that user input is in a specific format (specifically "mm/dd/yyyy"). Here's what I got:
Any help is greatly appreciated, thanks!![]()
Please Login or Register to view this content.
Hello!
I'm trying to find a way to verify that user input is in a specific format (specifically "mm/dd/yyyy"). Here's what I got:
Any help is greatly appreciated, thanks!![]()
Please Login or Register to view this content.
ttt
*bump*
![]()
Please Login or Register to view this content.
Post responsibly. Search for excelforum.com
Thank you, Chippy
After I read your post, I realized where I went wrong. I was using the Like function at first, but I was using "Loop While" instead of "Loop Until." Of course, VBA wasn't accepting anything in that date format, but it was accepting everything that wasn't in the format. So tedious, my logic.
In addition to Chippy's suggested code. It is worth checking that the date is valid by using IsDate VBA function. This will ensure that the user has not incorrectly entered an invalid date (e.g. 29/02/2011, 31/09/2012), which can easily be done as there is no validation on the input.
Thank you, ducky
A combination of the LIKE with the added ISDATE method is exactly what I was looking for. Now, the code checks for a date in a specific format using dual nested DO LOOPS. A rather short solution, I might add.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks