Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combo or Checkbox
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combo or Checkbox
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 "SMERTZ" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combo or Checkbox
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 "Steve" wrote in message ... 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 "SMERTZ" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combo or Checkbox
Post your code to see.
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "SMERTZ" wrote in message ... 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 "Steve" wrote in message ... 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 "SMERTZ" wrote in message ... 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combo or Checkbox
Change the MultiSelect Property of the listbox to '1-fmMultiSelectMulti'
this will allow you to select multiple items "SMERTZ" wrote in message ... 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 "Steve" wrote in message ... 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 "SMERTZ" wrote in message ... 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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combo or Checkbox
Thanks, it was the multiselect property.
"Steve" wrote in message ... Change the MultiSelect Property of the listbox to '1-fmMultiSelectMulti' this will allow you to select multiple items "SMERTZ" wrote in message ... 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 "Steve" wrote in message ... 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 "SMERTZ" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to have Checkbox A uncheck with checked Checkbox B | Excel Discussion (Misc queries) | |||
linking a form combo box... results from the combo box to another | Excel Discussion (Misc queries) | |||
checkbox on form reset from checkbox on sheet | Excel Programming | |||
"Combo Box - getting control combo box to stick in place in worksh | Excel Discussion (Misc queries) | |||
"Combo Box - getting control combo box to stick in place in worksh | Excel Discussion (Misc queries) |