title: How to remove a row in Excel based on cell value?
body: <p>I have an Excel and I want delete some rows based on the particular cell value, but the Excel is very very huge it has got around 75000  rows. I tried writing a normal function to loop through the sheet, check for the cell value and delete the rows if matched, but it is taking very long time. I waited for 30 min and program was still running can some one suggest me how to achieve this.</p>
  
  <p>Following is the code.</p>
  
  <pre><code>Private Sub CommandButton1_Click()
      Dim i As Integer
  
          For i = Range("D1").End(xlDown).Row To 1 Step -1
                  If Cells(i, 4) = 7 Then
                      Rows(i).Delete Shift:=xlUp
                  End If
          Next i
  End Sub
  </code></pre>
  
  <p>I tested this code for small Excel file with 50 rows and it is working fine. But when I try on the excel I wanted to try it kept me waiting for 30 min and could not complete. </p>