+ Reply to Thread
Results 1 to 9 of 9

Macros merge cells in a column based on same cell in another column

  1. #1
    Registered User
    Join Date
    07-04-2015
    Location
    STUTTGART, GERMANY
    MS-Off Ver
    2010
    Posts
    4

    Macros merge cells in a column based on same cell in another column

    Hello there,

    i need help trying to merge cells in the first column based on matching data in the third column using macros.

    i have already made sorting according to the points and now i want to merge cells in column "a" in order to make some kind of ranking. If it's possible also to re-number column ''a'' so the result should look like in the second table:


    Untitled.png
    thanks in advance

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macros merge cells in a column based on same cell in another column

    Hi and welcome to the forum.

    Try this...
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Macros merge cells in a column based on same cell in another column

    Hi, welcome to the forum

    I would like to give a word of caution regarding creating and using merged cells. They cause all sorts of problems with formulas, we always advise against using them, if at all possoble
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    07-04-2015
    Location
    STUTTGART, GERMANY
    MS-Off Ver
    2010
    Posts
    4

    Re: Macros merge cells in a column based on same cell in another column

    AlphaFrog :THANS A LOT IT WORKS PERFECTLY, BUT I HAVE ANOTHER QUSTION REGARDING VARIABLES. BEACAUSE I HAVE 20 SIMILAR TABLES AND I WANT TO MAKE EVERYTING IN ONE MACRO AND FOR EVERY TABLE I HAVE 3 VARIABLES WITH CONSECUTIVE LETTERS, WHAT IS NEXT WHEN I REACH ''Z"?

    FDibbins: IN THIS CASE I DON'T HAVE FORMULAS INSIDE CELLS, SO THERE IS NO PROBLEM WITH MERGING.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Macros merge cells in a column based on same cell in another column

    It's not the formulas IN the cells that causes the problems, its referencing cells that are merged, that causes the problems

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macros merge cells in a column based on same cell in another column

    Quote Originally Posted by nadiayo View Post
    alphafrog :thans a lot it works perfectly, but i have another qustion regarding variables. Beacause i have 20 similar tables and i want to make everyting in one macro and for every table i have 3 variables with consecutive letters, what is next when i reach ''z"?
    you're welcome.
    I have no idea what that means.

  7. #7
    Registered User
    Join Date
    07-04-2015
    Location
    STUTTGART, GERMANY
    MS-Off Ver
    2010
    Posts
    4

    Re: Macros merge cells in a column based on same cell in another column

    Hi, my macro is a little bit longer and before this, it umerges all cells. That is the last part of it that i was missing.

  8. #8
    Registered User
    Join Date
    07-04-2015
    Location
    STUTTGART, GERMANY
    MS-Off Ver
    2010
    Posts
    4

    Re: Macros merge cells in a column based on same cell in another column

    Quote Originally Posted by AlphaFrog View Post
    you're welcome.
    I have no idea what that means.
    Sorry, i was not so good in expressing what i mean. But i found the solution. I have 20 more tables like this, and for numbering and merging you gave me 3 variables (i, j, k). So for each table i needed 3 more letters and i reached the end of the alphabet )) but i continued with aa, ab and ac and it works.

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macros merge cells in a column based on same cell in another column

    Quote Originally Posted by NADIAYO View Post
    Sorry, i was not so good in expressing what i mean. But i found the solution. I have 20 more tables like this, and for numbering and merging you gave me 3 variables (i, j, k). So for each table i needed 3 more letters and i reached the end of the alphabet )) but i continued with aa, ab and ac and it works.

    Variables are reusable. You could simply use i, j, and k for the other tables as well. You would have to reset j back to zero for each table e.g. j = 0 at the start of a table's code.

+ 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] Merge cells from column A based on list in column B
    By d_max_c in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2014, 02:19 PM
  2. VBA to Merge Cells based on Other Column Values
    By meystingray in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-19-2014, 11:10 AM
  3. Merge values from column in one cell, based on duplicates in another column
    By Rawland_Hustle in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-24-2014, 11:04 AM
  4. need to merge cells in column B based on data in column A
    By saintdesy in forum Excel General
    Replies: 2
    Last Post: 08-15-2012, 05:50 AM
  5. Merge cells in a column based on cells highlighted in other column
    By nileshrg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-27-2011, 03:22 AM

Tags for this Thread

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