title: Comparing DateTime from cell with two dates VBA
body: <p>I am trying to compare the dates with time from inside a cell with Now()</p>
  
  <p>I have the code so the style sheet autorefresh itself so when first date with time is overdue cell go green and when the second date and time is overdue the cell would go red.</p>
  
  <p>I can only get this to work comparing the date without the time with DateValue.</p>
  
  <p>There is a colunm with cells with two dates with times mayorly (sometimes there is only 1 date and sometimes there is only one date without time)</p>
  
  <p>Cells with two dates with time would be as the example below.</p>
  
  <pre><code>-----------------
  12/11/2011 09:00
  13/11/2011 15:00
  -----------------
  </code></pre>
  
  <p>This is what I have so far after several attempts (cosidering that many of the attemps have been deleted already)</p>
  
  <pre><code>Sub Worksheet_Change()
  
   Set aWorkBook = Workbooks("Workbook.xls").Sheets("sheet 2").Range("C3:C10")
  
  
      For Each Cell In aWorkBook
      'MsgBox (Mid(Cell.Value, 1, 19))
      If Cell.Value &lt;&gt; "" Then
      MsgBox (Now &lt; Mid(Cell.Value, 11, 6))
      'MsgBox ((Mid(Cell.Value, 1, 17)) &lt; Now())
      'MsgBox ((Cell.Value))
  
          If (CDate(Mid(Cell.Value, 1, 17)) &lt; Now()) Then
                'MsgBox ("Hello")
                'Cell.Interior.ColorIndex = 3
            End If
  
         End If
      Next
  End Sub
  </code></pre>
  
  <p>In this case I am using msgbox to test outcome but not success.</p>
  
  <p>Any help would be very much appreciated.</p>