Deleting Rows Where Cells in Multiple Columns are Blank

sbarski

New Member
Joined
Apr 17, 2013
Messages
4
I work with a spreadsheet every week to input values and subtotal them. These values change constantly and instead of going through and manually deleting each row in a 100+ row spreadsheet to be able to import into another program, I'm looking for an quicker way to keep my data in order but consolidate by getting rid of only the rows where both column A and B are blank.

Here's an example of what I'm working with:
5
10
15
20
50
2
4
6
8
20

<tbody>
</tbody>
This is what I need the final product to look like:
5
10
15
20
50
2
4
6
8
20

<tbody>
</tbody>
So I would like to quickly delete rows 2, 5, and 11. All of the other answers I've found only show how to delete rows based on empty cells in only 1 column.
How can I quickly delete the rows where both columns are empty?

Thank you!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi and welcome to the Board
Try this macro
Code:
Sub delem()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 1 Step -1
    If Range("A" & r).Value = "" And Range("B" & r).Value = "" Then Rows(r).Delete
Next r
End Sub
 
Upvote 0
Michael,

Thanks for the reply. I really don't understand macros. Is there a way to do it without using one?
 
Upvote 0
Here's a fairly quick manual way.

1. If the data does not have headers, add some (insert a new row if needed)

2. Select the whole data area, including headings and apply AutoFilter.

3. Filter each column to show (Blanks)

4. Excluding the headings, select from the row immediately below the headings to below the last hidden row and delete the rows

5. Remove the AutoFilter altogether, or set each column's filter back to (Select All)
 
Upvote 0
Thanks Peter! I just tried it out on a small scale and it seemed to work perfectly. I'm excited to try it out at work tomorrow with one of the 100+ row spreadsheets!
 
Upvote 0
Just tried it out on one of my spreadsheets at work - 350 rows down to only the ones I needed in 10 seconds!! Thank you Peter, your solution worked perfectly!!!
 
Upvote 0
Just to note this manual fix is so easy - thanks for that. Once I performed the changes I had a list with lots of blanks but that's easy to fix.
 
Upvote 0

Forum statistics

Threads
1,216,730
Messages
6,132,398
Members
449,725
Latest member
Enero1

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