Hello Excel Users!!
Is there a way to delete empty rows in the data?
a few months ago, I posted the same thread here, and, in reply, the VBA codes suggested to me were:
Sub DeleteEmptyLines2()
Dim r As Range
Dim numCells As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
numCells = ActiveSheet.UsedRange.Rows(1).Cells.Count
For Each r In ActiveSheet.UsedRange.Rows
If WorksheetFunction.CountBlank(r) = numCells Then
r.EntireRow.Delete
End If
Next
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
OR
Sub DeleteEmptyRows()
Dim r As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
For Each r In ActiveSheet.UsedRange.Rows
If WorksheetFunction.CountA(r) = 0 Then
r.EntireRow.Delete
End If
Next
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
They did the job well, but now they are not working. I tried it them excel 2007 on a trial balance which had alternative rows empty. Now I am trying both codes in 2007 and 2013, they aren't eliminating the empty rows from the data.
I have a different trial balance which I have exported from a software, it has alternative rows with no data in them. I want to delete them. Could you please help me out.
Thanking you.
Is there a way to delete empty rows in the data?
a few months ago, I posted the same thread here, and, in reply, the VBA codes suggested to me were:
Sub DeleteEmptyLines2()
Dim r As Range
Dim numCells As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
numCells = ActiveSheet.UsedRange.Rows(1).Cells.Count
For Each r In ActiveSheet.UsedRange.Rows
If WorksheetFunction.CountBlank(r) = numCells Then
r.EntireRow.Delete
End If
Next
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
OR
Sub DeleteEmptyRows()
Dim r As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
For Each r In ActiveSheet.UsedRange.Rows
If WorksheetFunction.CountA(r) = 0 Then
r.EntireRow.Delete
End If
Next
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
They did the job well, but now they are not working. I tried it them excel 2007 on a trial balance which had alternative rows empty. Now I am trying both codes in 2007 and 2013, they aren't eliminating the empty rows from the data.
I have a different trial balance which I have exported from a software, it has alternative rows with no data in them. I want to delete them. Could you please help me out.
Thanking you.