Results 1 to 4 of 4

Thread: Need all but one blank row deleted
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2018
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Need all but one blank row deleted

    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!

  2. #2
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,989
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: Need all but one blank row deleted

    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 by Peter_SSs; May 5th, 2018 at 09:43 AM.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  3. #3
    New Member
    Join Date
    May 2018
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Need all but one blank row deleted

    This worked flawlessly for my needs! Thank you so very much!!

  4. #4
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,989
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: Need all but one blank row deleted

    Quote Originally Posted by spatula View Post
    This worked flawlessly for my needs! Thank you so very much!!
    You are very welcome.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •