title: Excel : Need to delete about 1 million blank rows
body: <p>I have an excel file from one of our customers and the file has close to 1 million blank rows.</p>
  
  <p>I did try filtering it on column C (called Items) where it is blank and then chose all rows and tried deleting. It almost froze for nearly couple of hours but at the end I had kill excel process.</p>
  
  <p>I also tried below VBA script but the actual line where it says "r.rows(i).Delete" just freezes. This is for the 1st delete instance itself.</p>
  
  <p>I have the excel file set to Manual for formula calculation also.</p>
  
  <p>I don't mind the entire job taking few hours. I can leave it overnight and check in the morning. </p>
  
  <p>If there is anything with VB.NET or C# that's also fine.</p>
  
  <p><strong>Update  1:</strong>  I can't do bulk delete as between 1 to 1048576 rows, I need to delete those rows where column C is blank (which means the row is blank).</p>
  
  <p><strong>Update 2:</strong> I marked the below deletion as the answer but I eventually ended up resolving the issue by copying the GOOD rows to another worksheet.</p>
  
  <p>Please suggest the best options to handle this scenario.</p>
  
  <p>VBA source</p>
  
  <pre><code>Sub BlankRowDelete()
  
  Dim r As Range, rows As Long, i As Long
  Application.ScreenUpdating = False
  Application.DisplayStatusBar = False
  Application.Calculation = xlCalculationManual
  Application.EnableEvents = False
  ActiveSheet.DisplayPageBreaks = False
  ActiveSheet.AutoFilterMode = False
  
  Set r = ActiveSheet.Range("A1:A1048576")
  rows = r.rows.Count
  For i = rows To 1 Step (-1)
      If WorksheetFunction.CountA(r.rows(i)) = 0 Then
          r.rows(i).Delete
          RowDeleted = RowDeleted + 1
      Else
          NotDeleted = NotDeleted + 1
      End If
      totalcnt = totalcnt + 1
      If RowDeleted = 100 Then
         TotalDeleted = TotalDeleted + RowDeleted
         RowDeleted = 0
         Debug.Print "count now is " + totalcnt
      End If
      Application.StatusBar = "Row count is " + totalcnt
  Next
  Application.ScreenUpdating = False
  Application.DisplayStatusBar = True
  Application.Calculation = xlCalculationAutomatic
  Application.EnableEvents = True
  ActiveSheet.DisplayPageBreaks = True
  ActiveSheet.AutoFilterMode = True
  </code></pre>
  
  <p>End Sub</p>