Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple selection AND Excel Discussion (Misc queries) 9 February 13th 09 07:40 PM
multiple selection.... AND Excel Worksheet Functions 1 February 13th 09 12:35 AM
Multiple selection David Excel Programming 1 January 12th 06 05:43 AM
Multiple Col. Selection David Fixemer Excel Programming 6 February 17th 04 11:10 PM
multiple selection Michalll Excel Programming 3 December 3rd 03 12:58 AM


All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"