This post will guide you how to delete blank or empty rows or rows that contain blank cells in excel. If you want to remove blank rows that contain blank cells, you can use the Go To Special command. But if you just want to remove rows that are entirely blank, you should use the Filter blanks cell way.
Delete rows that contain blank cells
You can use the Go To Special command to remove all rows that contain blank cells, just do the following:
1# on the HOME tab, click Find & Select command under Editing group
2# click Go To Special
3# Select Blanks radio button and then click OK button.
4# you will see that all rows that contain blank cells are selected.
5# go to HOME tab, click Delete command under Cells group. Then click Delete Sheet Rows from the drop down menu list.
Delete Blank Rows
If you want to remove blank rows in excel, and you need to find the entire blank rows firstly, so you can use the Filter function to filter all blank rows, just do this following:
1# select the range of cells that you want to remove blank rows
2# on the DATA tab, click Filter command under Sort& Filter group.
3# click Filter arrow button and uncheck the Select All box, just check only Blanks, then all blank rows in that column will be filtered.
4# you need to continue to filter other columns for blank cells until all cells in the selected range are blank.
5# select all the filtered rows, go to HOME tab, click Delete command under Cells group. Then click Delete Sheet Rows from the drop down menu list.
Or just right-click on the selected cell and then click Delete Row from the drop-down menu list.
6# on the DATA tab, click Clear command under Sort & Filter group.
7# you will see that all blank rows are removed.
Delete blank rows in Excel VBA
You can also write an excel Macro to delete blank rows in excel, just refer to the following steps:
1# click on “Visual Basic” command under DEVELOPER Tab.
2# then the “Visual Basic Editor” window will appear.
3# click “Insert” ->”Module” to create a new module
4# paste the below VBA code into the code window. Then clicking “Save” button.
Sub RemoveBlankRows() Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "Remove blank rows" Set WorkRng = Application.Selection Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8) xRows = WorkRng.Rows.Count Application.ScreenUpdating = False For i = xRows To 1 Step -1 If Application.WorksheetFunction.CountA(WorkRng.Rows(i)) = 0 Then WorkRng.Rows(i).EntireRow.Delete XlDeleteShiftDirection.xlShiftUp End If Next Application.ScreenUpdating = True End Sub
5# back to the current worksheet, then run the above excel macro.