Delete all blank rows

imported_unknown

Active Member
Joined
Jan 13, 2002
Messages
424
My first time using a spreadsheet. I need a way to select and delete all blank rows, never knowing the number of rows there will be. I want to remove all rows with no data that are located between rows with data.

Thanks for any help.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Click on one of the column letters at the top of the worksheet, so that the whole column is highlighted.
Then, from Edit>Go To>Special>Blanks>OK
(All the blank cells in the column will be highlighted)
Lastly, from Edit>Delete>Entire rows
 
Upvote 0
Can you use the data (or lack of data) in one of your columns as the basis of an empty row? If you can, this bit of code might get you started:

Code:
Sub DeleteBlankRows()
Sheets("Sheet1").Activate

Lastrow = Range("A65536").End(xlUp).Row

For i = Lastrow To 1 Step -1
    Cells(i, 1).Activate
    If ActiveCell.Value = "" Then
        Rows(i).Delete
    End If
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,613
Messages
6,120,515
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top