Discussion Locked
0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a file some 1500 lines long. Every 5 to 10 lines, there is a blank row. How can I remove all of the blank rows with one command?
1 reply
I found this macro for deleting multiple blank rows at www.mrexcel.com. It works in both Excel 97 and 2000.
Select a range or multiple ranges and run the following macro:
Sub DeleteBlankRows()
Dim num As Integer, I As Integer
Dim area As Object
For Each area In Selection.Areas
area.Select
num = Selection.Rows.Count
If num = 65536 Then
num = Selection.SpecialCells(xlLastCell).Row
End If
'loop through each row and delete if all cells are empty.
For I = 1 To num
If Application.CountA(ActiveCell.EntireRow) = 0 Then
ActiveCell.EntireRow.Delete
Else
If I <> num Then ActiveCell.Offset(1, 0).Select
End If
Next I
Next 'loop back and do next area
End Sub
This discussion is closed to new replies.
Trending Desktop posts
Sort by Trending
0 helpful
2 replies
Question
Floppy drive wont work on my 486
0 helpful
1 reply
Discussion
How to make light speed agent go away
0 helpful
4 replies
Discussion Locked
Ryzen 7 7700
0 helpful
2 replies
Question Locked
Issue fully resetting my PC
0 helpful
4 replies