+ Reply to Thread
Results 1 to 2 of 2

Button that creates delimited comma list

Hybrid View

  1. #1
    Registered User
    Join Date
    04-28-2010
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2003
    Posts
    28

    Button that creates delimited comma list

    Hello,

    I'd like to create a button that does the following:

    - Button is located in every city sheet (button module) and uses cell A1 as reference (i.e., 'LA' sheet uses Los Angeles)

    - Click creates search in 'Internships' for rows with "A1-Approved" in column H (i.e. for LA again, it would be Los Angeles-Approved. This is so I can use it on every sheet in my workbook without creating separate modules)

    - Creates a delimited comma list of all approved internships (column B of every approved row) in cell G6 of the city sheet

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Button that creates delimited comma list

    Hi

    This code should bring back what you want. Just have the buttons call it.

    Sub aaa()
      Dim ThisSH As Worksheet
      Set ThisSH = ActiveSheet
      
      srchstr = ThisSH.Range("A1") & "-Approved"
      holder = ""
      
      With Sheets("Internships")
        For Each ce In .Range(.Range("H3"), .Cells(Rows.Count, "H").End(xlUp))
          If ce = srchstr Then
            holder = holder & .Cells(ce.Row, 2) & ", "
          End If
        Next ce
      End With
      If Len(holder) > 2 Then holder = Left(holder, Len(holder) - 2)
      
      ThisSH.Range("G6").Value = holder
    End Sub
    rylo

+ 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