+ Reply to Thread
Results 1 to 8 of 8

Merging Cells With Duplicate Values

  1. #1
    Registered User
    Join Date
    01-10-2008
    Posts
    44

    Merging Cells With Duplicate Values

    Hi,

    Is there a way to create a macro that identifies equal values in various cells within a selected column range and then merges those cells together.

    I have uploaded a picture to illustrate what I mean. The second column should be the final product with the merged cells.

    I have found this thread where the macro seems to identify the duplicate entries and then color codes it.
    http://www.exceltip.com/st/Identifyi...ange/1090.html

    I was trying to edit it, but I don't have much experience in coding.

    Thanks a lot! Any help is appreciated.
    Attached Images Attached Images

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    It's possible -- it's easy -- but I'd urge you not to. Merged cells are a major pain in the neck. You can't sort them, manipulating them is a nuisance, and they are the bane of VBA.

  3. #3
    Registered User
    Join Date
    01-10-2008
    Posts
    44
    Well, I would not need to manipulate them in any way after they are merged. It's mostly for formatting purposes for a spreadsheet.

    Do you have any examples (code) of how I can achieve this.

    Thanks!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-10-2008
    Posts
    44
    Wow! That was amazing. Thanks a lot.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    You're welcome. Remember the caveat.

  7. #7
    Registered User
    Join Date
    09-07-2011
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Merging Cells With Duplicate Values

    Hi there,

    I've had great success using the above code.
    However, I'm hoping to obtain some guidance on changing the code to merge contents across a row rather than down a column.

    Could you please confirm how this could be performed? I too will not wish to manipulate the data once the merge has been confirmed.

    Cheers,
    LE1882

  8. #8
    Registered User
    Join Date
    05-09-2010
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Merging Cells With Duplicate Values

    This script has been super useful! Thank you.

    I would like to ask though if it would be possible after using this script on column 2 for example (where all M1s & M2s respectively, are merged), to merge the As in Col 1 based on the merged M1s and M2s. In other words, the first two As would be merged, followed by the next 2 As and so on, corresponding to the merged cells in Col 2.

    Col1 | Col2
    A | M1
    A | M1
    A | M2
    A | M2

    Thank you! Does that make sense?

+ 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