Multiple Selection from Drop Down List

paankadu

New Member
Joined
Nov 6, 2009
Messages
24
I have a list created on a separate sheet in my workbook named List. On 2 other worksheets (Day Log, Night Log) I want to be able to select multiple items from that list. The list is employee names and it is labeled Operators. My drop down list is on Day Log cell B2 and I would like to be able to select 1 or more names and have them in the same cell, separated by a comma. Any help would be appreciated.

Thanks so much!
Angie
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
That would require VBA, I hope that's ok?

1) Right-click on the sheet tab and select VIEW CODE
2) Paste in these two macros and edit the range to your needs
Rich (BB code):
Public Prior As String

Private Sub Worksheet_Change(ByVal Target As Range)
'JBeaucaire  10/2/2009)
'These two macros create a multi-choice dropbox
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
    If Not Intersect(Target, Range("B2")) Is Nothing Then
        If Target <> "" Then
            If Prior <> "" Then Target = Target.Text & "," & Prior
            Prior = Target
        Else
            Prior = ""
        End If
    End If
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("B2")) Is Nothing Then _
        Prior = Target.Text
End Sub
3) Close the editor and save your sheet.
 
Upvote 0
Wow, love the quick response. I am somewhat familiar with VBA and learning all the time thanks to people like you.

Am I putting this code on the sheet that has the Lists or on the day and night log sheets?

I put the range in as b2:b36 because that is where the names are at, however they are on a different worksheet than the dropdown.

Thanks for help in clarifying.
Ang
 
Upvote 0
Do not adjust the range to match the list of names. Adjust the range to match the cells where the drop boxes are. You indicated it was just cell B2, which is why I posted it with that value.

This code goes in the sheet where you're doing the selecting in a drop box, not where the names are listed.
 
Upvote 0
Got it! I was having a dense moment there...

How would I do it if I wanted to have multiple lists perform the same way. I know I can't create duplicate code because of ambiguous error so how do I set different ranges.

The next list would be in cell b3.

Thanks again
 
Upvote 0
The code isn't watching your lists, it's watching the cells where you're doing the selecting. IF you want more cells to behave the same way, expand the range of watched cells.

Rich (BB code):
If Not Intersect(Target, Range("B2:B3")) Is Nothing Then

or

If Not Intersect(Target, Range("B2:B100")) Is Nothing Then

You get the idea...
 
Upvote 0
The code isn't watching your lists, it's watching the cells where you're doing the selecting. IF you want more cells to behave the same way, expand the range of watched cells.

Rich (BB code):
If Not Intersect(Target, Range("B2:B3")) Is Nothing Then

or

If Not Intersect(Target, Range("B2:B100")) Is Nothing Then

You get the idea...

.
 
Upvote 0
---------------------------------------

Hi
Thank you for the post .
This code works very perfectly however i got stucked in a scenario where i have the list in column u2:u10(Refrence Value for drop down) and i want the results on column b2:b30(Refrence 1, Refrence2, Refrence3 and so on based on selection). I tried to call the macro by activating the cell and column B but that didnt helped.
Please help me here.
Appreciate your help here.
Many Thanks
Sam
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top