How to delete duplicate empty rows in excel?

bob122

New Member
Joined
May 10, 2018
Messages
17
Okay so everybody knows how to delete mass empty rows via the go to special blank option. But how can I delete only the duplicate empty rows? EG:

77
98
88

<tbody>
</tbody>

so above turns into:

77
98
88


<tbody>
</tbody>
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Assuming blanks in Column A equate to blanks in other columns, here is a macro that should do what you want...
Code:
[table="width: 500"]
[tr]
	[td]Sub LeaveOneBlankRow()
  Dim Ar As Range
  With Range("A1", Cells(Rows.Count, "A").End(xlUp))
    For Each Ar In .SpecialCells(xlBlanks).Areas
      If Ar.Rows.Count > 1 Then Ar.Offset(1).Resize(Ar.Rows.Count - 1).EntireRow.Delete
    Next
  End With
End Sub[/td]
[/tr]
[/table]

HOW TO INSTALL MACROs
------------------------------------
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (LeaveOneBlankRow) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "Yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
B​
C​
D​
E​
1​
Hdr1
Hdr2
Formula
2​
7​
8​
0​
D2: =(COUNT(B2:C2) = 0) * SUM(D1, 1)
3​
1​
4​
2​
5​
4​
7​
0​
6​
1​
9​
0​
7​
1​
8​
4​
8​
0​
9​
1​
10​
7​
5​
0​
11​
1​
12​
2​
13​
3​
14​
7​
7​
0​
15​
6​
8​
0​
16​
8​
8​
0​
17​
1​
18​
2​
19​
3​
20​
4​
21​
5​
22​
6​
23​
7​
8​
0​

Filter for col D > 1, delete those rows, unfilter, delete col D.
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,639
Members
449,093
Latest member
Ahmad123098

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