VBA code to concatenate disproportionate data in MS Excel 2007

Posted on 2011-04-21
Last Modified: 2012-05-11
Dear experts,

I'm having trouble by concatenating data shown in the image attached.

Can you please assist?

Question by:sarpcakir
    LVL 43

    Accepted Solution

    Try this macro
    Sub clrcat()
    clr = Cells(2, 1).Interior.Color
    For i = 2 To Cells(2, 1).End(xlDown).Row
        If Cells(i, 1).Interior.Color = clr Then
            pfx = Cells(i, 1)
            Cells(i, 2) = pfx & Cells(i, 1)
        End If
    Next i
    End Sub

    Open in new window


    Author Closing Comment


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
    Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
    This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now