title: If Then Statement with dates
body: <p>I am programming a command button so that it may give me the assets that were sold between two dates.</p>
  
  <p><strong>A run time error 13: mismatch</strong> currently appears when i run the code. </p>
  
  <p>I changed the <code>If Then</code> statement  but i still get the same error. Below is an example of what i am trying to accomplish with the button. I want the code to look through all the dates in the sheet. Then those rows that are in-between the two dates are to be copied then pasted into another sheet.</p>
  
  <pre><code>| Asset#    | Asset Name S# | Sold     |
  |-----------|---------------|----------|
  | 4555#1202 | Scissor Lift  | 12/15/12 |
  | 4898#1204 | Light Tower   | 11/12/15 |
  </code></pre>
  
  <p>This is the code I'm running for the command button:</p>
  
  <pre><code>Private Sub CommandButton9_Click() 
  
      Worksheets("Paste2").Rows("2:1000").Delete
  
      Dim erow As Long, start As Date, enddt As Date
  
      x = 2
  
      '*The 12 represents the column which contains the date for when the asset was sold*
  
      Do While Worksheets("Asset Info").Cells(x, 12) &lt;&gt; ""
  
          start = DateValue("October 1,2016")
          enddt = DateValue("October 31,2016")
  
          If Worksheets("Asset Info").Range("L1:L2500") &gt; start And Worksheets("Asset Info").Range("L1:L2500") &lt; enddt Then  '*This is where the error occurs in the code*        
  
              Worksheets("Asset Info").Rows(x).Copy
              Worksheets("Paste2").Activate
  
              erow = Worksheets("Paste2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row        
              ActiveSheet.Paste Destination:=Worksheets("Paste2").Rows(erow)    
          End If
  
          Worksheets("Paste2").Activate       
          x = x + 1    
  
      Loop    
  
      Worksheets("Paste2").Activate
  End Sub
  </code></pre>
  
  <p>Any suggestions will greatly be appreciated.</p>
  
  <p><a href="https://i.stack.imgur.com/H5coP.png" rel="nofollow noreferrer">an example of sheet im trying to copy </a></p>
  
  <p>Other form for the command button </p>
  
  <pre><code>`Worksheets("Paste2").Rows("2:1000").Delete
  
  
  Dim erow As Long, LastRow As Long, start As Date, enddt As Date
  
  LastRow = Workheets("Asset Info").Cells(Workheets("Asset Info").Rows.Count, "L").End(xlUp).Row
  
  For x = 2 To LastRow
  
      start = DateValue("October 1,2016")
      enddt = DateValue("October 31,2016")
  
      If Worksheets("Asset Info").Cells(x, 12).Value &lt;&gt; "" &gt; start And Worksheets("Asset Info").Cells(x, 12).Value &lt;&gt; "" &lt; enddt Then
  
  
          Worksheets("Asset Info").Rows(x).Copy
          Worksheets("Paste2").Activate
  
          erow = Worksheets("Paste2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
  
          ActiveSheet.Paste Destination:=Worksheets("Paste2").Rows(erow)
  
     End If
  Next x
  
  End Sub`
  </code></pre>