Need all but one blank row deleted

spatula

New Member
Joined
May 5, 2018
Messages
2
First of all, this is my first post so bare with me. I have been playing around with macros for Excel and have been able to find pretty much everything that I need. The communities are great and appreciate that there are so many willing to helping one another out! Kudos to all!

My situation is that I have to pull reports from some of our documentational software to an excel spreadsheet. The software gives me multiple blank rows (2-3). I do need to be able to separate the groupings as this has to be printed and handed over to another team to work from and do need to have the blank rows. But I only need one blank row. I have had to manually delete the additional blank rows and sometimes it is not a big deal, but other times it is a lot and is something that I need to do repeatedly throughout the day. Can someone help with this situation?

Thanks in advance!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Welcome to the MrExcel board!

Assuming the blanks can be determined from column A and that there will always be at least one blank in that column, try this on a copy of your data.
Code:
Sub KeppOneBlankRow()
  Dim rA As Range
  
  Application.ScreenUpdating = False
  For Each rA In Columns("A").SpecialCells(xlBlanks).Areas
    If rA.Rows.Count > 1 Then rA.Resize(rA.Rows.Count - 1).EntireRow.Delete
  Next rA
  Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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