title: Macro - delete rows based on date
body: <p>I am very new to VBA and macros in Excel. I have a very large excel spreadsheet in which column A holds dates. I am trying to delete the rows which have a value smaller than a certain date and this is what I have come up with till now.. </p>
  
  <pre><code>Sub DELETEDATE()
  Dim x As Long
  For x = 1 To Cells.SpecialCells(xlCellTypeLastCell).Row
  Debug.Print Cells(x, "A").Value
  If CDate(Cells(x, "A")) &lt; CDate("01/01/2013") Then
  Cells(i, "A").EntireRow.Delete
  End If
  Next x
  Next i
  End Sub
  </code></pre>
  
  <p>I am receiving a Next without For error... can somebody help please? </p>