Delete extra empty rows

G

gwc

How can I delete all but one empty row between each row or group of
consecutive rows containing data?

Here is portion of my spreadsheet:

xxxxxxx
xxxxxxx
xxxxxxx
xxxxxxx
xxxxxxx



xxxxxxx
xxxxxxx
xxxxxxx

xxxxxxxx
xxxxxxxx






xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx
xxxxxxxx

xxxxxxxx
xxxxxxxx

xxxxxxxx




xxxxxxxxx
xxxxxxxxx
 
D

Don Guillett

Sub deleteallbutoneblankrowSAS()
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i, 1) = "" And Cells(i + 1, 1) = "" _
Then Rows(i + 1).Delete
Next i
End Sub
=======
 
G

gwc

Sub deleteallbutoneblankrowSAS()
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i, 1) = "" And Cells(i + 1, 1) = "" _
Then Rows(i + 1).Delete
Next i
End Sub
=======




- Show quoted text -

Thanks.
 

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