Removing Blank Rows in an excel spreadsheet

P

Phyllis

I have a spreadsheet that contains blank row to separate data, I need to
remove all the blank rows in order to resort the data for creating labels.
 
J

jlclyde

I have a spreadsheet that contains blank row to separate data, I need to
remove all the blank rows in order to resort the data for creating labels..

Are you asking how to remove the blank rows? cause you can just sort
the sheet and the blank rows will go to the bottom. If you are
wondering how to sort the sheet and then put the rows back in, then
that is a little trickier.

Jay
 
C

Chip Pearson

You can do it with simple code:

Sub RemoveBlankRows()
Dim WS As Worksheet
Dim RNdx As Long
Dim LastRow As Long

Set WS = Worksheets("Sheet1")
With WS
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

For RNdx = LastRow To 1 Step -1
If Application.CountA(WS.Rows(RNdx)) = 0 Then
WS.Rows(RNdx).Delete
End If
Next RNdx
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
P

Phyllis

Thank you so much! Worked like a charm!

Chip Pearson said:
You can do it with simple code:

Sub RemoveBlankRows()
Dim WS As Worksheet
Dim RNdx As Long
Dim LastRow As Long

Set WS = Worksheets("Sheet1")
With WS
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

For RNdx = LastRow To 1 Step -1
If Application.CountA(WS.Rows(RNdx)) = 0 Then
WS.Rows(RNdx).Delete
End If
Next RNdx
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
G

Gord Dibben

Select a column with the blank rows.

F5>Special>Blanks>OK

Edit>Delete>Entire Row


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top