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!
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
44,464
Office Version
365
Platform
Windows
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:

Watch MrExcel Video

Forum statistics

Threads
1,096,287
Messages
5,449,463
Members
405,566
Latest member
JeIIyfish

This Week's Hot Topics

Top