title: How to delete rows in Excel based on certain values
body: <p>I have a workbook with 10 sheets. Each sheet has about 30,000 rows with URL. I have a hand full of URLs (about 10 different URLs) that I need to keep the data. Is there a way to delete all the rows from all the worksheet if the first column (Column A - URL) does not contain one of the URL.</p>
  
  <p>for example, I would like to keep we.abc.us, ss.boli.us and 3m.mark.us and delete rest of the rows from all the worksheet in the workbook. </p>
  
  <pre><code>Sub delete0rows()
  
  Dim Worksheet As Excel.Worksheet
  Dim lastRow As Long
  Dim i As Integer
  
  For Each Worksheet In Application.ThisWorkbook.Worksheets
  lastRow = Worksheet.Cells(Rows.Count, 1).End(xlUp).Row
  
  i = 1
  
      Do While i &lt;= lastRow
  
          If Worksheet.Range("A" &amp; i).Value = 0 Then
          Worksheet.Rows(i).Delete i = i - 1
          lastRow = lastRow - 1
          End
      i = i + 1
      Loop
  Next Worksheet
  End Sub
  </code></pre>