View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Date Comparison in Code

On Mon, 4 Oct 2004 14:47:42 -0700, "nbs"
wrote:

Here is the actual code that causes this interesting
problem:

If Sheets("Monitor").Cells(6, 5).Value Sheets
("Corrective Actions").Cells(6, 5).Value Then
UserForm1.Show

Both are date formatted fields as described below, yet it
seems to be only looking at the time of day.

Thanks for any further insight!!


You wrote that you checked the formatting of the fields but you did write that
you checked the actual contents of the fields.

Even if the fields are formatted as date, it is still possible for the contents
of one (or both) of the fields to be TEXT. See what =ISTEXT(cell_ref) shows.


--ron