title: Run Time Error 13 - Mismatch on Date
body: <p>avid reader, first time poster here. I have a Macro that I obtained from the internet for the most part, then made some adjustments. It's purpose is to color code cells that have passed a certain duration. It was working fine earlier, but now I am getting an error on it for a "Type Mismatch". The line that reads "This is where the error is" is where I am getting the mismatch. I am puzzled because it was working fine earlier. I am not a seasoned programmer by any means, but I just try to troubleshoot things. I have looked all over the net and cant find a specific answer to my question. </p>
  
  <p>In addition, if any of you are willing, I would appreciate your advice on how to make this code run ONLY at startup of the workbook and NOT periodically as it is set up to do so now.This code is not placed in a worksheet, but in a Module.I mention this because I am not sure how much of a practical difference it can make any help is appreciated, thanks!</p>
  
  <pre><code> Public TimeToRun As Date
  
  Sub Auto_Open()
  Call ScheduleCompareTime
    End Sub
  
  Sub ScheduleCompareTime()
  TimeToRun = Now + TimeValue("00:00:10")
  Application.OnTime TimeToRun, "CompareTimeStamp"
    End Sub
  
  Sub CompareTimeStamp()
  Dim rgTimeStamp As Range
  Dim rdTimeStamp As Range
  Dim i As Long
  Dim j As Long
  Dim MyNow As Date
  Dim TimeStamp As Date, TimeStampp As Date
  
  Set rgTimeStamp = Range("c1:c500")
  Set rdTimeStamp = Range("H1:h500")
  
  For i = 1 To rgTimeStamp.Rows.Count
  
      If Not rgTimeStamp.Cells(i, 1) &lt; 1 Then 'don't run for an empty cell
  
          MyNow = CDate(Now - TimeSerial(0, 0, 0)) 'time instantly
          TimeStamp = CDate(rgTimeStamp.Cells(i, 1)) 'THIS IS WHERE THE ERROR IS!!
          If TimeStamp &lt; MyNow Then 'if it's old at all
              rgTimeStamp.Cells(i, 1).Interior.ColorIndex = 3 'make fill colour red
          End If
      End If
  
    Next
  
  For j = 1 To rdTimeStamp.Rows.Count
  
      If Not rdTimeStamp.Cells(j, 1) &lt; 1 Then
  
          MyNow = CDate(Now - TimeSerial(0, 0, 0))
          TimeStampp = CDate(rdTimeStamp.Cells(j, 1))
          If TimeStampp &lt; MyNow Then
              rdTimeStamp.Cells(j, 1).Interior.ColorIndex = 3
          End If
  
  
      End If 'closes If Not
  Next
  Call ScheduleCompareTime  'begins the scheduler again
  End Sub
  
  Sub auto_close() 'turn the scheduler off so you can close workbook
  Application.OnTime TimeToRun, "CompareTimeStamp", , False
  End Sub
  </code></pre>