Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Select multiple values

Hello all,

I'm trying to see if it's possible to create a list box where I can select
multiple values. For example, if a create a list box with the values, "ant",
"dog", and "cat". Is it possible for me to give the user the option to
choose, "ant" and "cat"?

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 105
Default Select multiple values

Hello.
Use the Multiselect property of the listbox.
To retrieve the selected items, use (case of a worksheet listbox :

With Sheet1.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
'code
End If
Next i
End With

HTH
Daniel

Hello all,

I'm trying to see if it's possible to create a list box where I can select
multiple values. For example, if a create a list box with the values, "ant",
"dog", and "cat". Is it possible for me to give the user the option to
choose, "ant" and "cat"?

Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Select multiple values

Hi

Your answer seems the best way to do it but ive not used if statements in
Excel before so require abit of guidance.

So how and where would I place the code.

Right now I have a excel file called -Document process
within the file I have two worksheets - 1.document , 2. Data.

I have placed in 2.data a column (A) called animals and populated that with
my animal options for my list.

In 1.Document I place a column (B) called animal choices.

How would I use the if statement to populate in 1.document cell (B2) with
multiple choices made.

Thanks in advance


"Daniel.C" wrote:

Hello.
Use the Multiselect property of the listbox.
To retrieve the selected items, use (case of a worksheet listbox :

With Sheet1.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
'code
End If
Next i
End With

HTH
Daniel

Hello all,

I'm trying to see if it's possible to create a list box where I can select
multiple values. For example, if a create a list box with the values, "ant",
"dog", and "cat". Is it possible for me to give the user the option to
choose, "ant" and "cat"?

Thanks in advance.




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 105
Default Select multiple values

Select sheet 1.document
click on menus : View, Toolbars, Controls toolbox. Click on listbox,
draw it on the sheet. Click on properties, change the multiselect
property to 1 or 2. find the "listfillrange" property and enter :
'2.Data'!A1:A10
where A1:A10 is your list of animals.
(if you expect to add or delete entries in the list, please tell it, i
shall modify this).
Add a command button. Change the Caption property to "OK" or whatever
you want.
Close the properties window and click on "view code".
Between "Private Sub CommandButton1_Click()" and "End Sub, paste the
following code :

'clear cell B2
[B2] = ""
'every element beginning with a dot refers to
'Sheets("1.document").ListBox1
With Sheets("1.document").ListBox1
'loops through the listbox element
For i = 0 To .ListCount - 1
'when selected
If .Selected(i) Then
[B2] = [B2] & .List(i) & " "
.Selected(i) = False
End If
Next i
End With

Your workbook should look like mine :
http://www.filedropper.com/atencorps
Daniel

Hi

Your answer seems the best way to do it but ive not used if statements in
Excel before so require abit of guidance.

So how and where would I place the code.

Right now I have a excel file called -Document process
within the file I have two worksheets - 1.document , 2. Data.

I have placed in 2.data a column (A) called animals and populated that with
my animal options for my list.

In 1.Document I place a column (B) called animal choices.

How would I use the if statement to populate in 1.document cell (B2) with
multiple choices made.

Thanks in advance


"Daniel.C" wrote:

Hello.
Use the Multiselect property of the listbox.
To retrieve the selected items, use (case of a worksheet listbox :

With Sheet1.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
'code
End If
Next i
End With

HTH
Daniel

Hello all,

I'm trying to see if it's possible to create a list box where I can select
multiple values. For example, if a create a list box with the values,
"ant", "dog", and "cat". Is it possible for me to give the user the option
to choose, "ant" and "cat"?

Thanks in advance.






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Select multiple values

Explicitly list them. Just like a data validation list:

ant
dog
cat
ant and dog
ant and cat
dog and cat
ant and dog and cat

--
Gary''s Student - gsnu200814


"Atencorps" wrote:

Hello all,

I'm trying to see if it's possible to create a list box where I can select
multiple values. For example, if a create a list box with the values, "ant",
"dog", and "cat". Is it possible for me to give the user the option to
choose, "ant" and "cat"?

Thanks in advance.



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
select value in table based on values entered in multiple cells claudard64 Excel Worksheet Functions 3 November 16th 08 12:05 PM
select multiple criteria multiple worksheets koneil Excel Worksheet Functions 1 December 12th 07 04:31 PM
Lost ability to select multiple cells w/ values & see sum, why? Marianne New Users to Excel 1 October 19th 07 01:00 AM
with a drop down list in excel how do I select multiple values Keith H Excel Discussion (Misc queries) 1 July 13th 06 06:08 PM
creating drop down lists where you can select multiple values Angella Excel Discussion (Misc queries) 2 April 23rd 05 04:58 PM


All times are GMT +1. The time now is 07:19 AM.

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

About Us

"It's about Microsoft Excel"