+ Reply to Thread
Results 1 to 2 of 2

Adding names from different cells to a consolidated list in one cell

Hybrid View

  1. #1
    Registered User
    Join Date
    06-08-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2003
    Posts
    12

    Adding names from different cells to a consolidated list in one cell

    As the topic describes I need to add names from different cells to a consolidated list in one single cell. This could be done easily with the "Concatenate" function. The problem is that the names are spread out over different cells in a spreadsheet.

    The combining key factor is that all name end with /ABC.

    So what I am trying to do is to write a piece of VBA code that searches all cells in a spreadsheet (or just from A1-Z200 would be more than enough), and makes a single text string in a single cell out of all values ending with /ABC.


    Hope you can help.

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Adding names from different cells to a consolidated list in one cell

    Hi check this
    Sub aa()
    With Worksheets(1).Range("a2:z200")
        Set c = .Find("/ABC", LookIn:=xlValues)
        If Not c Is Nothing Then
            firstAddress = c.Address
            Do
                [a1] = [a1] & " " & c
                Set c = .FindNext(c)
            Loop While Not c Is Nothing And c.Address <> firstAddress
        End If
    End With
    
    End Sub
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

+ 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