Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
linking a form combo box... results from the combo box to another Trey Excel Discussion (Misc queries) 1 July 15th 07 01:58 AM
checkbox on form reset from checkbox on sheet raw[_12_] Excel Programming 1 December 3rd 05 05:08 AM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 1 February 16th 05 02:05 AM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 0 February 15th 05 07:45 PM


All times are GMT +1. The time now is 02:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"