Drop-down list with multiple entries in a single cell - Page 6

Thanks Thanks:  0
Likes Likes:  0
Page 6 of 6 FirstFirst ... 456
Results 51 to 56 of 56

Thread: Drop-down list with multiple entries in a single cell

  1. #51
    New Member
    Join Date
    Nov 2016
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Drop-down list with multiple entries in a single cell

     
    Quote Originally Posted by AlphaFrog View Post
    I had previously made two separate suggestions. Sorry I didn't make that clear.

    Suggestion 1 was to make a UserForm.
    Suggestion 2 was to use a Data Validation drop down list and use the code I provided to concatenate multiple selections from that list. The code I previously provided assumed the Data Validation drop down list was in cell M10.

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

    This is how to make the user form solution. I think it's probably the better way to do it for your situation.

    Create a userform with two controls on it; a ListBox and a command button.
    ListBox1
    CommandButton1

    Put this code in the UserForm's code module...
    Code:
    Private Sub UserForm_Initialize()
    
        With ListBox1
            .List = Range("CL4:CL103").Value    'Range of cells with the list of cities
            .MultiSelect = fmMultiSelectMulti
        End With
        
        UserForm1.Caption = "Select Cities"
        CommandButton1.Caption = "Okay"
        
    End Sub
    
    
    Private Sub CommandButton1_Click()
    
        Dim i As Long, strTemp As String
        With ListBox1
            For i = 0 To .ListCount - 1
                If .Selected(i) Then strTemp = strTemp & .List(i) & ", "
            Next i
        End With
        If Len(strTemp) Then
            strTemp = Left(strTemp, Len(strTemp) - 2)
            ActiveCell.Value = strTemp
        End If
        Unload Me
        
    End Sub
    Put this in the worksheet module. Right-click on the sheet tab and select View Code. Paste the code below VBA Edit window.
    Code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        If Target.Count = 1 Then
            'Range of cells to have the pop-up userform
            If Not Intersect(Range("D15:D314"), Target) Is Nothing Then
                UserForm1.Show
            End If
        End If
    End Sub
    Hallo AlphaFrog I did the same like you suggest to Innoguide and it worked very good but I need to make more drop down lists in diffrent cells with diffrent data in one worksheet.
    UserForm code (my data is in a diffrent sheet named "DropDownData)

    Code:
    Private Sub UserForm_Initialize()
    
    
        With ListBox1
            .List = Range("DropDownData!G2:G16").Value    'Range of cells with the list of krone
            .MultiSelect = fmMultiSelectMulti
        End With
        
        UserForm1.Caption = "Select Krone"
        CommandButton1.Caption = "Okay"
        
    End Sub
    
    
    
    
    Private Sub CommandButton1_Click()
    
    
        Dim i As Long, strTemp As String
        With ListBox1
            For i = 0 To .ListCount - 1
                If .Selected(i) Then strTemp = strTemp & .List(i) & ", "
            Next i
        End With
        If Len(strTemp) Then
            strTemp = Left(strTemp, Len(strTemp) - 2)
            ActiveCell.Value = strTemp
        End If


    Worksheet code (worksheet name "DropDown")
    Code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        If Target.Count = 1 Then
            'Range of cells to have the pop-up userform
            If Not Intersect(Range("H2:H755"), Target) Is Nothing Then
                UserForm1.Show
            End If
        End If
    End Sub


    So what do I need to do to have more drop down list with diffrent data in diffrent cells (in worksheet "DropDown" from I to M)

    Thank you for your help!

  2. #52
    MrExcel MVP AlphaFrog's Avatar
    Join Date
    Sep 2009
    Posts
    15,521
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Drop-down list with multiple entries in a single cell

    Quote Originally Posted by Korbi View Post

    So what do I need to do to have more drop down list with diffrent data in diffrent cells (in worksheet "DropDown" from I to M)
    Change this...
    If Not Intersect(Range("H2:H755"), Target) Is Nothing Then

    To this...
    If Not Intersect(Range("I:M"), Target) Is Nothing Then

    Otherwise, I don't understand what you're asking.
    Last edited by AlphaFrog; Nov 22nd, 2016 at 01:04 PM.
    Paste your Excel data to the forum...
    MrExcel HTML Maker or Excel Jeanie

    How to post your vba code
    [CODE]your VBA code here[/CODE]
    The # button in the forum's editor will apply CODE tags around your selected text.

  3. #53
    New Member
    Join Date
    Nov 2016
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Drop-down list with multiple entries in a single cell

    Quote Originally Posted by AlphaFrog View Post
    Change this...
    If Not Intersect(Range("H2:H755"), Target) Is Nothing Then

    To this...
    If Not Intersect(Range("I:M"), Target) Is Nothing Then

    Otherwise, I don't understand what you're asking.
    I want this in the columns (I,J,K,L,M) but to put in diffrent data for diffrent columns with more the one to pick like in the first picture (column "H").

    [IMG]imgur.com/wBNwQsa[/IMG]

    For every column I have diffrent data like in the second picture so i wanna be able to pick data for column "I" in the DropDown-sheet from column "I" in the DropDownData-sheet

    [IMG]imgur.com/f2axGbk[/IMG]

    Thank you!

  4. #54
    New Member
    Join Date
    Nov 2016
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Drop-down list with multiple entries in a single cell

    I want this in the columns (I,J,K,L,M) but to put in diffrent data for diffrent columns with more the one to pick like in the first picture (column "H").

    http://imgur.com/wBNwQsa

    For every column I have diffrent data like in the second picture so i wanna be able to pick data for column "I" in the DropDown-sheet from column "I" in the DropDownData-sheet

    http://imgur.com/f2axGbk

    Thank you!

  5. #55
    New Member
    Join Date
    Nov 2017
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Drop-down list with multiple entries in a single cell

    Here is my solution to your problem:
    http://www.vlsiip.com/exceltips.html
    'enjoy
    -Aviral Mittal

    Quote Originally Posted by Innoguide View Post
    Is there anyway, I can create a drop down list that allows users to choose items from a list and place them into a single cell with comma separation (e.g. Rome, New York, Rio Di Janero)

    If I could limit it to one item per cell, a simple drop down data validation list would work, but I need to limit entry to 1 cell/column.

    Any suggestions would be much appreciated.

  6. #56
    New Member
    Join Date
    Nov 2017
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Drop-down list with multiple entries in a single cell

      
    Quote Originally Posted by Innoguide View Post
    Is there anyway, I can create a drop down list that allows users to choose items from a list and place them into a single cell with comma separation (e.g. Rome, New York, Rio Di Janero)

    If I could limit it to one item per cell, a simple drop down data validation list would work, but I need to limit entry to 1 cell/column.

    Any suggestions would be much appreciated.

    download the complete solution from here:
    http://www.vlsiip.com/exceltips.html

    Hope it helps.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com