Remove empty rows in excel?

C

Clbmgr

I have edited an excel worksheet by deleting rows of info. How do I get rid
of the empty rows
 
R

Ron de Bruin

Hi Clbmgr

You can't delete the rows, but you can hide them if you want
Select the rows and in the menubar

Format>Row>Hide

Or
Ctrl -
 
C

Christopher Anderson

Try this macro:




Public Sub DeleteBlankRows()

Dim R As Long
Dim C As Range
Dim Rng As Range

On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
For R = Rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(Rng.Rows(R).EntireRow) = 0 Then
Rng.Rows(R).EntireRow.Delete
End If
Next R

EndMacro:

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub



This will delete ALL completely blank rows in a workbook. If even one cell
contains info in the row it will not be deleted.

CHRISTOPHER
 
G

Gord Dibben

Do you mean you "cleared contents" on these rows and now you want to eliminate
the empty rows?

Select a column and F5>Special>Blanks>OK

Edit>Delete>Entire Row

Gord Dibben Excel MVP
 
D

Dave Peterson

Maybe you could just sort by a column that always has something in it if the row
is used.
 
Top