+ Reply to Thread
Results 1 to 3 of 3

adding values as 1 string, based on adjacent column

  1. #1
    Registered User
    Join Date
    05-24-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question adding values as 1 string, based on adjacent column

    I'll try to keep this a straight forward as possible. I'd like take all the names in multiple row and add them together as one string, based on the status of an adjacent column.

    A B
    bill yes
    joe yes
    kim no
    mary yes


    To get: "bill, joe, mary"

    I can get the string made, but cant quite get the "based-on" part ...
    ---------------------------------------------------
    Sub GetSSM()

    Dim i, LastRow, OneCell

    LastRow = Range("B" & Rows.Count).End(xlUp).Row

    Range("AA1").Value = ""

    For i = 1 To LastRow


    OneCell = OneCell & Cells(i, "B").Value & ", "
    Next
    Range("AA1").Value = Left(OneCell, Len(OneCell) - 1)
    Range("AA1").Select
    'Selection.Copy

    ------------------------------

    Thanks in advance!!
    TC

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: adding values as 1 string, based on adjacent column

    You need to add some code tags to your post, before you get a smack, but the resolution is quite easy:

    Please Login or Register  to view this content.
    (Assuming that your names are in column A and the yes/no in column B, as per your example (although your code contradicts this).

  3. #3
    Registered User
    Join Date
    05-24-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: adding values as 1 string, based on adjacent column

    Thanks for your quick response. Yes, i noticed my code was not matching after I posted. I took the actual bits and tried to simplify.

    I wil go and add this and let you know.

+ 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