View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Prem Prem is offline
external usenet poster
 
Posts: 45
Default Selecting Multiple items from drop down list

Hi Mike,
I am using Excel 2007. When you mention, "right click the list box and set
these
properties

ListFillRange=A1:A6
MultiSelect=fmMultiSelectMulti
ListStyle=fmListStyleOption" should I key it in under "assign macro" option?

"Mike H" wrote:

Hi,

Try this.

Open the 'Control' toolbox and put a listbox and a button on you sheet.
Ensuring your in 'Design' mode right click the list box and set these
properties

ListFillRange=A1:A6
MultiSelect=fmMultiSelectMulti
ListStyle=fmListStyleOption

For the listfill range use whatever you want. The listbox is now set up.
Enter you 6 categories in a1 - A6
Still in design mode double click the button and paste the code below in.
Exit design mode and make your selections and they will be transfeered to
column B.

Private Sub CommandButton1_Click()
Dim Selected As Long
Dim Checked As Boolean
Dim LastRow As Long
For Selected = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(Selected) Then
Checked = True
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & LastRow + 1) = ListBox1.List(Selected)
ListBox1.Selected(Selected) = False
End If
Next Selected
If Checked = False Then
MsgBox "Nothing Selected"
End If
End Sub


Mike

"prem" wrote:

Hi guys I am trying to create a student register.

Right now I have 3 columns; "Student Name", "Number of Subjects registered"
and "Subjects Registered".

The students' names are entered manually. The number of subjects is selected
from a drop down list, giving selection options from 1 to 6.

I would like help with the "Subjects Registered" column. There are only a
maximum of 6 fixed subjects that a student can register for, English, Math,
History, Chemistry, Physics and Accounts. Is there a way I can put this in a
drop down list and select multiple items, maybe by checking boxes so that
they are all listed in a cell? Or is there some other way to do this apart
from drop down lists?

I would appreciate any help offered. Thank you.