+ Reply to Thread
Results 1 to 10 of 10

Delete Merged Cells and move

  1. #1
    Registered User
    Join Date
    06-15-2022
    Location
    Wolverhampton, England
    MS-Off Ver
    10
    Posts
    2

    Delete Merged Cells and move

    On the attached file I have a list of live "job numbers" that are formatted in a specific colour. When a "job" is completed how do I both delete the job number and then get the proceeding jobs to move up to fill the blank by the deleted job?
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Delete Merged Cells and move

    You can delete the rows of the completed jobs. (Filter by color of the completed jobs.) delete the visible rows.

    Pete

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,279

    Re: Delete Merged Cells and move

    Why oh why make use of merged cells...Rule No 1 in Excel...Do not merge cells...
    Why not just increase the column width and row width for your exact size requirement...
    Last edited by sintek; 06-15-2023 at 12:39 PM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Delete Merged Cells and move

    Quote Originally Posted by sintek View Post
    ...Why not just increase the column width and row width for your exact size requirement...
    AGREED! But I wrote this anyway (standard module):
    Please Login or Register  to view this content.
    ...and this in the worksheet module:
    Please Login or Register  to view this content.
    Assign the Delete_Click macro to an AutoShape named Delete_Button, which will appear whenever you select a merged cell.
    Click it to delete the active cell.
    Attached Files Attached Files
    Last edited by leelnich; 06-15-2023 at 02:40 PM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,279

    Re: Delete Merged Cells and move

    AGREED! But I wrote this anyway
    Now just imagine how simplistic this would be if the "BUTTONS" were single cells...
    Double click event... do the exercise and teach OP...

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Delete Merged Cells and move

    Quote Originally Posted by sintek View Post
    Now just imagine how simplistic this would be if the "BUTTONS" were single cells...
    Double click event... do the exercise and teach OP...
    I think I'll leave the preachin' to you.
    Meanwhile, I was never happy w/ the workflow in my previous code, so I wrote the following, which adds a "Remove Job #nnnn" command to the Cells Right-Click Context Menu. (right after Clear Contents). In a standard module:

    Please see post#10; I fixed a bug in this code (and uploaded the workbook). - Lee

    Please Login or Register  to view this content.
    ...and this in the Worksheet module:
    Please Login or Register  to view this content.
    Just right-click on the cell and select that command to process the removal.
    Last edited by leelnich; 06-17-2023 at 09:54 PM.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,279

    Re: Delete Merged Cells and move

    get the proceeding jobs to move up to fill the blank by the deleted job
    Non merged option...Simply...Double clicking on cell
    Please Login or Register  to view this content.
    Unless you mean something else by quote above...like having last used at last column to be moved to fill gap then...Not as simple...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by sintek; 06-16-2023 at 05:45 AM.

  8. #8
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Delete Merged Cells and move

    Quote Originally Posted by sintek View Post
    ...Unless you mean something else ...
    In the OPs original data, numbers are sorted top to bottom, then wrap around to the top of the next column. I'm just guessing, but I think the OP wants to preserve that order by moving everything below the Target up, and then moving the top of the next column into the open slot. Then the remainder of THAT column shifts up, and the top of the next column fills in...cascading down to the last column, which ends up having 1 less entry.

    OPsNumbers.jpg

    In the picture, he hasn't physically shifted the "New Numbers" columns, but logically, 2342 et al should move to the top, with ensuing columns filling in behind.

    BTW, I'm glad you gave OP a demo w some actual code. Maybe he'll see the light... though I did have a problem on every 7th d-click. - Lee

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,279

    Re: Delete Merged Cells and move

    Interesting thread this Lee...I like your out of the box thinking...I just assume that as each no box has a specific link, the order would not make a difference...Guess we'll only know once OP responds...
    though I did have a problem on every 7th d-click
    Guess I did not test to full capacity...Random selections etc etc ...

  10. #10
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Delete Merged Cells and move

    Hey, found a bug in my code - deleting a cell from first column caused the WHOLE bottom row to evaporate! I used a relative reference, when it should have been absolute. Here's the fix:
    Please Login or Register  to view this content.
    I also improved on the code for handling the custom control:
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Delete Rows With Merged Cells and Cell Color
    By werko in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2018, 07:01 PM
  2. [SOLVED] Delete rows after merged cells
    By Madz0220 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2017, 03:43 AM
  3. [SOLVED] How to move merged cells in VBA?
    By ImranBhatti in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2016, 01:59 PM
  4. Replies: 2
    Last Post: 10-22-2013, 06:01 AM
  5. Delete top row in merged cells while keeping text?
    By FrederikBjerre in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-17-2011, 04:43 AM
  6. [SOLVED] VBA script to delete content in merged cells.
    By Calle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2006, 10:10 PM
  7. Move merged cells with conditional formatting?
    By SpikeUK in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-08-2005, 01:04 PM

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