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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com