+ Reply to Thread
Results 1 to 6 of 6

Excel macro to combine cells from different rows based on value of another row

  1. #1
    Registered User
    Join Date
    04-26-2012
    Location
    Toccoa, Georgia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Excel macro to combine cells from different rows based on value of another row

    Does anyone have a macro (or some other Excel solution) to combine cells from different rows based on a sequential number from 1 to 25 in another row (while also concatenating a space between the merged cells). I have attached a sample spreadsheet with some data and a sample of the desired output. Thank you for your help in advance!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Excel macro to combine cells from different rows based on value of another row

    Hi
    try this macro
    select the cell where you want the concatenated data to start (eg A24 of the example you posted).

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-26-2012
    Location
    Toccoa, Georgia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Excel macro to combine cells from different rows based on value of another row

    Thank you for your reply and for the code. I get the following output, but no data in the concatenated field:

    1AAGRAY 116330 AA 2 1
    2ABL74 114103 AB 2 1
    3ABZBC 112868 ABOND 2 1
    1ADB102 115981 ADB 3 1

    Any ideas? I have access to Excel 2007 and 2010 at work if you think that would make a difference...

  4. #4
    Registered User
    Join Date
    04-26-2012
    Location
    Toccoa, Georgia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Excel macro to combine cells from different rows based on value of another row

    Hey, I got it. I added one line:

    ActiveCell.Offset(0, 5).Value = txt

    And it works perfect. Thanks again for your help!!

  5. #5
    Registered User
    Join Date
    02-13-2012
    Location
    australia
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Excel macro to combine cells from different rows based on value of another row

    would this work if i have more than 5 columns to combile.. based on column A .. I might have 100 or 200 cells in Column F

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Excel macro to combine cells from different rows based on value of another row

    @ harryisurs

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

+ 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