Jez_B 
Member 
 
Registered: 8th Nov 06
 Location: Towcester, Northants 
User status: Offline 
 
 | 
 
Hello, 
 
Does anyone know how to validate a date using Visual Basic code, for example the month can only be 1 - 12, the year must be greater than today's, and the separator must be a "/". 
 
Thanks Jez. 
 
ps: the date is a user entered expiry date.
 | 
Baskey 
Member 
 
Registered: 31st May 06
 
User status: Offline 
 
 | 
 
Im on an iphone mate so cant nip into excel to have a look at some vba for you, however if you are wanting users to use a constant date format can you not just restrict the cells to that format using data validation? 
 
[Edited on 18-02-2010 by Baskey]
 | 
pow 
Premium Member
 
Registered: 11th Sep 06
 Location: Hazlemere, Buckinghamshire 
User status: Offline 
 
 | 
 
Data Validation
 | 
Jez_B 
Member 
 
Registered: 8th Nov 06
 Location: Towcester, Northants 
User status: Offline 
 
 | 
 
Cheers for the help lads, but unfortunately it had to be formatted using VBA code aswell as data validation, as data validation can be overwritten if a macro is used to populate the data.  
 
No worries.  
 
Jez
 |