How to delete blank rows?

Joe Kickass

New Member
Joined
Jun 2, 2009
Messages
7
hi guys,

I have a spreadsheet similar to the (poor) example below...

Basically, i need to delete the rows that do not contain any data
(i.e. rows 1, 6 & 9)

A B C D E F
1
2 OK OK OK OK
3 OK OK
4 OK OK OK OK
5 OK
6
7 OK OK OK OK OK
8 OK OK OK OK
9
10 OK OK OK OK OK

What I'm trying to do at the moment is select ("A1:F1") and find out if there is any data in these cells, if not delete the row then, move down a row and repeat.

Can anyone suggest an easy way to do this please??

Thanks!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
You could AutoFilter column A for Blanks and delete the visible rows. Or you could use the formula:

=COUNTA(A1:F1)=0

AutoFilter for TRUE and delete the visible rows.
 
Upvote 0
Try this: ALT + F11 to open the Visual Basic Editor, Insert > Module and paste in

Code:
Sub DelBl()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = LR To 1 Step -1
    If WorksheetFunction.CountA(Rows(i)) = 0 Then Rows(i).Delete
Next i
End Sub

Press ALT + Q to return to your sheet, Tools > Macro > Macros, click on DelBl then click the Run button.
 
Upvote 0
OK, this isn't working and i think it is because my first example wasn't clear enough.

Is there any way that i can paste a section of my Excel spreadsheet in here?
 
Upvote 0
If you choose the Board's Enhanced Message Editor Interface you can copy an Excel range and paste it into a reply. To do so click User CP on the blue bar at the top of this window, then click Edit Options and scroll to the bottom.
 
Upvote 0

Forum statistics

Threads
1,215,584
Messages
6,125,669
Members
449,248
Latest member
wayneho98

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