+ Reply to Thread
Results 1 to 4 of 4

Delete empty cells within row until you hit nonempty cell

  1. #1
    Registered User
    Join Date
    05-03-2004
    Posts
    39

    Delete empty cells within row until you hit nonempty cell

    Hi! I hope someone can help me with this problem - I am going nuts over it, but I am sure there is a macro that could achieve this:

    I need to delete empty cells within a sheet, row by row, until I hit cells in that row that are not empty. For example:

    A B C D E F
    1 1 1 1 1 1
    2 2 2 2 2 2
    3 3 3
    4 4 4 4 4 4
    5 5
    6 6 6 6 6 6

    I want to select the first cell in column A, and then start running the macro. The macro should detect that row one should be left untouched, and proceed to row 2, than to row 3, and delete cells there, then proceed...
    However, after cells have been deleted and a nonempty cell is hit, it should not delete empty cells after that. So, the above example should end up looking like this:

    A B C D E F
    1 1 1 1 1 1
    2 2 2 2 2 2
    3 3 3
    4 4 4 4 4 4
    5 5
    6 6 6 6 6 6

    This is for a non-commercial purpose - and I hope one of you could share their insight. It would save me weeks of work (I am talking tens of thousands of rows...).

    Thanks so much!

    as

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    I can't see any difference between the before and after example. Where is the difference???


    rylo

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    From your description, this might work
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    05-03-2004
    Posts
    39
    @ rylo (and other who were confused):

    Yep, sorry, I didn't preview my post, the example pasted incorrectly. In the first example, there should have been empty cells at the beginning of rows 3 and 5.

    @ mikerickson:

    This works! Thanks so much for investing the time to help.

    I continue to be amazed by the skills people have - but even more so that everyone here is sharing so freely.
    Thanks a bunch!

    as

+ 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