title: Deleting all rows containing a specific value (most efficient method?)
body: <p>Hi there I am trying to write a macro that processes a huge file (talking 30-35k rows). I have a loop that goes through all the cells in column <code>A</code> and deletes all rows where the date in column <code>A</code> doesn't equal yesterday's date. (sounds convoluted I know). Is there any more efficient way of doing this? I mean the loop works but it frequently crashes excel and times out etc. </p>
  
  <pre><code>Sub PSAudit()
  Dim Auditdate As String
  Dim rng As Range
  Dim psm as worksheet
  
  Set psm = Sheets("PS_MAIN")
  Application.ScreenUpdating = False
  
          Auditdate = Format(Date - 1, "yyyy-mm-dd")
  
      lastrow = Cells(Rows.Count, "A").End(xlUp).Row
      For x = 1 To lastrow
  
          If psm.Range("A" &amp; x).Value &lt;&gt; Auditdate Then psm.Range("A" &amp; x).EntireRow.Delete
  
      Next x
  
  
  Application.ScreenUpdating = True
  
  
  End Sub
  </code></pre>