Combo or Checkbox

  • Thread starter Thread starter SMERTZ
  • Start date Start date
S

SMERTZ

I would like to add to a cell or a range of cells a data validation.
However the list box in datavalidation will not allow more than one
selection. The list will be peoples names.

Bill
Bob
Carol
Scott

I want to assign on occasion more than one person in the cell. So my
question is; Is it best to use a combo box, or maybe a form that pops up
when someone clicks in a range of cells with a check box of names?

Can someone let me know what is the better way to go, and please provide an
example if it is in code?

Thank You
 
Assuming you have a form with a filled listbox and a command button
This will drop the selected items into the active cell
You can run this from a toolbar or shortcut perhaps

Private Sub CommandButton1_Click()
Dim strnames As String
Dim x As Integer

For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) Then
strnames = strnames & ListBox1.List(x) & ", "
End If
Next x

If Not strnames = "" Then
strnames = Left(strnames, Len(strnames) - 1)
End If
ActiveCell.Value = strnames
End Sub

Steve H
 
I created a simple form with a OK, Cancel button and a list box. In the
form init I populated the list box. However when I select OK, it only puts
one name in the active cell. It does not allow multiple selections.

Any Ideas
 
Post your code to see.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Change the MultiSelect Property of the listbox to '1-fmMultiSelectMulti'
this will allow you to select multiple items
 
Thanks, it was the multiselect property.

Steve said:
Change the MultiSelect Property of the listbox to '1-fmMultiSelectMulti'
this will allow you to select multiple items
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top