-
Nov 10th, 2014, 04:43 PM
#1
Thread Starter
Lively Member
Excel VBA Multiple Selection Listbox
I'm using the Form Control List Box via the Developer Tab and I'm trying to figure out a code to take my selections (multiple selection list box) and display them in a single cell with the selections separated by a comma.
When I right click the list box and navigate to the "Format Control" option, I get the option to make the list box a multi-select list box.
However the selections default to "0" and I cannot figure out how to get the selections to display into cell G9 as follows:
"SelectionItem1, SelectionItem2, SelectionItem5, SelectionItem7..." [based on selections; into a single cell]
-
Nov 11th, 2014, 05:30 AM
#2
Re: Excel VBA Multiple Selection Listbox
as far as i am aware, you would need to use an activex listbox
a forms listbox in multiselect mode is only useful for visual return
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 12th, 2014, 12:54 PM
#3
Thread Starter
Lively Member
Re: Excel VBA Multiple Selection Listbox
What would the use of a "visual return" offer? I know I can create a userform and code it accorndingly, but there has to be a way to do this with the listbox; the information has to go somewhere.
Why does the reference cell default to "0" when multiple is selected? is the zero useful somehow?
-
Nov 12th, 2014, 02:54 PM
#4
Re: Excel VBA Multiple Selection Listbox
I know I can create a userform
why can you not put an activex listbox on you worksheet?
Why does the reference cell default to "0" when multiple is selected? is the zero useful somehow?
no, the normal return to the linked cell is the index of the selected list item, the way it works can only be with a single returned value, not multi select
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|