View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ian[_15_] Ian[_15_] is offline
external usenet poster
 
Posts: 2
Default 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,