View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default multiple selection in combo box

How about using a listbox from the control toolbox toolbar and a commandbutton
from that same toolbar.

Then you can use code like this to retrieve the selected items from the listbox:

Option Explicit
Private Sub CommandButton1_Click()

Dim iCtr As Long
Dim DestCell As Range

Set DestCell = Me.Range("a2")

With Me.ListBox1
DestCell.Resize(.ListCount).ClearContents
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) Then
DestCell.Value = .List(iCtr)
Set DestCell = DestCell.Offset(1, 0)
End If
Next iCtr
End With

End Sub

Double click on the commandbutton and you'll see where this code goes.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

jen_writer wrote:

Hello,
I'd like to use a combo box or drop-down list for selecting from a list.
However, I need to be able to select multiple items from the list. Is there a
way to set this up (e.g. hold the ctrl key and select)?

thank you
Jen


--

Dave Peterson