+ Reply to Thread
Results 1 to 7 of 7

[Macro] Remove blank rows (apart from 1 to separate datasets)

  1. #1
    Forum Contributor
    Join Date
    09-07-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    358

    [Macro] Remove blank rows (apart from 1 to separate datasets)

    Hi Guys, I'm looking for some help creating a macro to help fix my master document.

    The problem is that my master document sometimes gets loads of blank rows with no data in them, basically I need a macro to remove all but one blank row between each dataset

    In the example given I have marked the rows to be removed in red and the green ones are to keep, however the top 5 rows of the document should not be touched.

    See attached document for a better visual explanation.


    Help is much appreciated
    Regards
    - Hyflex
    Attached Files Attached Files
    Last edited by Hyflex; 06-08-2011 at 05:53 PM.

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: [Macro] Remove blank rows (apart from 1 to separate datasets)

    Hi

    See your amended workbook attached.

    The macro looks for empty cells in column A and deletes the entire row if there is more than 1 consecutive empty row.

    I'm sure someone will now point out that Excel has a built in function which will do a similar thing.

    Dion


    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: [Macro] Remove blank rows (apart from 1 to separate datasets)

    Hi Hyflex try:
    Please Login or Register  to view this content.
    This searches through column A to find consecutive empty rows. I would test it on a copy of your original workbook though, just to be safe.

    Regards:
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: [Macro] Remove blank rows (apart from 1 to separate datasets)

    Sorry mojo, I didn't see that you posted before me.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: [Macro] Remove blank rows (apart from 1 to separate datasets)

    hi, Hyflex, please check attachment, run code "test"
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    09-07-2010
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: [Macro] Remove blank rows (apart from 1 to separate datasets)

    Thank you very much guys, 3 choices but I have no idea what ones best/fastest :S

    Watersev's is very complicated to my eyes but looks good, you guys are all very helpful thank you

  7. #7
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: [Macro] Remove blank rows (apart from 1 to separate datasets)

    You're welcome Hyflex. If you have the answer(s) you want then please mark the thread as solved and don't be shy, hit up the scales for those that helped.

    Cheers!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1