title: Excel vba Deleting a row if a cell contains a text
body: <p>I'm using this code:  </p>
  
  <pre><code>Dim r As Integer   
  For r = 1 To Sheet1.UsedRange.Rows.Count        
      If Cells(r, "Q") = "0" Then           
      Sheet1.Rows(r).EntireRow.Delete    
      End If
  Next  
  </code></pre>
  
  <p>The problem is it doesn't delete everything, it just deletes some of the rows and i have to press the button that uses this code multiple times to delete all instances of "0" in "Q"   </p>
  
  <p><strong>Answers from similar questions</strong>  </p>
  
  <p><a href="https://stackoverflow.com/questions/17944074/how-to-reverse-a-for-loop">How to reverse a For loop</a><br>
    <a href="https://stackoverflow.com/questions/13614997/delete-row-based-on-search-key-vba">Delete Row based on Search Key VBA</a></p>