title: Removing Excel rows by search criteria
body: <p>I am trying to remove Excel rows which have number below integer 5 in the cells of column 13 by VBA. The code simply filters the rows by a search criteria, then deletes the unwanted rows.</p>
  <pre><code>'1. Apply Filter
    ws.Range(&quot;A5:O202&quot;).AutoFilter Field:=13, Criteria1:=&quot;&lt;5&quot;
    
    '2. Delete Rows
    Application.DisplayAlerts = False
      ws.Range(&quot;A5:O202&quot;).SpecialCells(xlCellTypeVisible).Delete
    Application.DisplayAlerts = True
    
    '3. Clear Filter
    On Error Resume Next
      ws.ShowAllData
    On Error GoTo 0
  </code></pre>
  <p>To get it going, my code specifies a static range to accommodate different table lengths up to 202 rows, however can I change this so that the range sets itself to one before the first empty cell it discovers in column 13?</p>