I have an excel file converted from a wordperfect file that contains roughly 600,000 lines of data. The data is currently in its raw form in excel ( see attached example). I am trying to run the following macro to delete empty rows and it will not finish. I have let it run for 8+minutes and it sends excel into "not responding" mode. The macro I am using is:
Sub DeleteEmptyRows()
Dim LastRow As Long
Dim r As Long
Dim Counter As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.UsedRange.Rows.Count + _
ActiveSheet.UsedRange.Rows(1).Row - 1
For r = LastRow To 1 Step -1
If Application.WorksheetFunction.CountA(Rows(r)) = 0 Then
Rows(r).Delete
Counter = Counter + 1
End If
Next r
Application.ScreenUpdating = True
MsgBox Counter & " Empty rows were deleted."
End Sub
I have run this macro a smaller test batch of data and it ran pretty quick. Does anyone have advice on how to fix this? Is running macros on 500,000+ rows even possible? After this I have several other macros to run to format the data the way it needs to be.
Bookmarks