I've got about 2K row of data inported from .txt format (so there are empty rows throughout). I need to delete the empty rows and then copy the contguous data to another spreadsheet. I've got this code, but am wondering if it is the most affective way to do that?
[VBA]
Option Explicit
Sub DeleteEmptyRows()
Dim i As Long
Application.ScreenUpdating = False
For i = Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Application.WorksheetFunction.CountA(Sheets(1).Cells(i, 1).EntireRow) = 0 Then
Sheets(1).Cells(i, 1).EntireRow.Delete
End If
Next
i = 0
For i = 1 To Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row
If Not Sheets(1).Cells(i, 1).EntireRow Is Nothing Then
Sheets(1).Cells(i, 1).EntireRow.Copy Sheets(2).Cells(Rows.Count, 1).End(xlUp).Offset(1)
End If
Next
Application.ScreenUpdating = True
End Sub
[/VBA]