Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
Hello !
I have a combobox on a userform and it works fine. I need a macro that will allow me to select multiple items in the dropdown list. Is this possible at all? Any help would be appreciated. Thanks! Jay *** Sent via Developersdex http://www.developersdex.com *** |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
Not completely sure, but I don't think it is possible to do that with a
ComboBox. Out of curiosity, if the user selected two or three items in your ComboBox, what would you display in the text field... the first item? If so, how would the user know there were other items selected and they were only looking at one of them? -- Rick (MVP - Excel) "jay dean" wrote in message ... Hello ! I have a combobox on a userform and it works fine. I need a macro that will allow me to select multiple items in the dropdown list. Is this possible at all? Any help would be appreciated. Thanks! Jay *** Sent via Developersdex http://www.developersdex.com *** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
hi
rick is right. combo boxes don't have multiselect properties. but a list box does. so you might want to consider that. but a disadvantage would be that, depending on the size of you list, this might casue a redesign of your form. and the codeing might be a tad trickier. but that just depends on how great your need for multiselect capabilities is. regards FSt1 "jay dean" wrote: Hello ! I have a combobox on a userform and it works fine. I need a macro that will allow me to select multiple items in the dropdown list. Is this possible at all? Any help would be appreciated. Thanks! Jay *** Sent via Developersdex http://www.developersdex.com *** |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
If you want the user to select multiple items, use a listbox.
jay dean wrote: Hello ! I have a combobox on a userform and it works fine. I need a macro that will allow me to select multiple items in the dropdown list. Is this possible at all? Any help would be appreciated. Thanks! Jay *** Sent via Developersdex http://www.developersdex.com *** -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
Rick, FSt1, and Dave -
Okay, if I use a listbox like you suggested and the user selects multiple items, I need a mcro that will concatenate the selected items into one string, maybe, store it in a string variable. For example: Dim Mylist as String. If a user selects 4 items in the list being: "I like" (1st slection), "studying" (2nd selection), "vba every" (3rd selection), and "other day" (4th selection), then Mylist should contain "I like studying vba every other day" **Please note that the number of selections 4 used in the above example is just an example. In reality, the user may select 0 items, 1 item, 2 items, 3 items, 4 itmes, 5 items,... etc. Any help would be appreciated. Thanks Jay *** Sent via Developersdex http://www.developersdex.com *** |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
Try code something like this...
Dim X As Long Dim CombinedText As String With ListBox1 For X = 0 To .ListCount - 1 If .Selected(X) Then CombinedText = CombinedText & " " & .List(X) End If Next End With ' CombinedText now has the selected items from ListBox1 ' concatenated together with a blank space between items If you need this combined text in other procedures, then the CombinedText variable should probably be Dim'med in a Module so it is global. -- Rick (MVP - Excel) "jay dean" wrote in message ... Rick, FSt1, and Dave - Okay, if I use a listbox like you suggested and the user selects multiple items, I need a mcro that will concatenate the selected items into one string, maybe, store it in a string variable. For example: Dim Mylist as String. If a user selects 4 items in the list being: "I like" (1st slection), "studying" (2nd selection), "vba every" (3rd selection), and "other day" (4th selection), then Mylist should contain "I like studying vba every other day" **Please note that the number of selections 4 used in the above example is just an example. In reality, the user may select 0 items, 1 item, 2 items, 3 items, 4 itmes, 5 items,... etc. Any help would be appreciated. Thanks Jay *** Sent via Developersdex http://www.developersdex.com *** |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
Thank you Rick...Your code works beautifully!!! One more thing. After my listbox loads its values, it displays 6 items at a time (per scroll). Is there a way I can increase the number of items it dsiplays in the window from 6 to about 10? I typically use the "ListRows" property for comboboxes, but listboxes don't give me that option. Thanks! Jay *** Sent via Developersdex http://www.developersdex.com *** |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
You only have two choices as far as I can see... either make the ListBox
taller or make the Font Size smaller (although doing the latter might make the text too small to be read). -- Rick (MVP - Excel) "jay dean" wrote in message ... Thank you Rick...Your code works beautifully!!! One more thing. After my listbox loads its values, it displays 6 items at a time (per scroll). Is there a way I can increase the number of items it dsiplays in the window from 6 to about 10? I typically use the "ListRows" property for comboboxes, but listboxes don't give me that option. Thanks! Jay *** Sent via Developersdex http://www.developersdex.com *** |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
MULTIPLE SELECTION !!
Thanks, Rick ! I appreciate the help. I have redefined the scope of the problem, and implemented the solution using a combobox, a listbox, and an activeX command. It works great. Your inputs have saved me a lot of time. Thanks again! Jay *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
multiple selection | Excel Discussion (Misc queries) | |||
multiple selection.... | Excel Worksheet Functions | |||
Multiple selection | Excel Programming | |||
Multiple Col. Selection | Excel Programming | |||
multiple selection | Excel Programming |