Checking for valid dates on entry
I have a sheet where users enter dates. Other routines run and
highlight cells in different colours depending on the dates.
If a user enters a date with a leading space, it still appears in the
cell to be a date but VBA thinks it is not. It is acceptable to have
a blank cell.
I am trying to trap these errors with the change event, but cannot
get it to work.
Any ideas.
validdate = Now() + 730
If Len(Trim(cell.Value)) 0 And (cell.Value validdate) Then MsgBox
"invalid date"
Thanks,
Ian,
|