title: excel macro cant recognize my second IF condition
body: <p>I have the following code to check if the cells starting from E15 are having date different of more than 45 day when comparing to today's date, the problem here is that it cant recognize the following condition and it will return error, the below was to check if the cell's value is date. Anything wrong to the below if condition?</p>
  
  <pre><code>IsDate(.Range("E" &amp; i)) = True
  
  
  
  
  
  Sub Refees()
  Dim ws As Worksheet
  Dim lRow As Long, i As Long, OutputRow As Long
  Dim copyRng As Range
  
  '~~&gt; Change this to the relevant worksheet
  Set ws = ActiveWorkbook.Sheets("Warranty Quote 1 Year")
  
  With ws
      '~~&gt; Get LatRow in Col B
      lRow = .Range("B" &amp; .Rows.Count).End(xlUp).Row
      OutputRow = lRow + 1
  
      '~~&gt; Loop through the cells
      For i = 15 To lRow
          If DateDiff("d", .Range("E" &amp; i).Value, Date) &gt; 45 And IsDate(.Range("E" &amp; i)) = True Then
              If copyRng Is Nothing Then
                  Set copyRng = .Range("B" &amp; i &amp; ":I" &amp; i)
              Else
                  Set copyRng = Union(copyRng, .Range("B" &amp; i &amp; ":I" &amp; i))
              End If
          End If
      Next i
  
      '~~&gt; Copy the expired records in one go
      If Not copyRng Is Nothing Then
          copyRng.Copy .Range("B" &amp; OutputRow)
  
          lRow = .Range("B" &amp; .Rows.Count).End(xlUp).Row
  
          .Range("I" &amp; OutputRow &amp; ":I" &amp; lRow).Value = "Reinstatement Fees"
      End If
  End With
  End Sub
  </code></pre>