Populating Sheet Data From A UserForm Combo Box Enabled For Multi-Choices

  • Thread starter Thread starter R3df1sh
  • Start date Start date
R

R3df1sh

I have a userform with a combo box. I have the combo box enabled to
allow multiple selections. My delima is I want to populate a field or
possibly multiple fields on sheet1 with these selected items. To give a
better understanding the combo list is a list of names I want to
populate on Sheet1 to make a cc: list. This can either be in a single
cell or multiple, just I have had no luck with coding it.

Thanks in advance for any help you can provide!
 
R

I assume you mean listbox and not combobox. This command button click event
sub will put all the selections in a single cell

Private Sub CommandButton1_Click()

Dim i As Long
Dim CCNames As String

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
CCNames = CCNames & Me.ListBox1.List(i) & Chr(10)
End If
Next i

CCNames = Left(CCNames, Len(CCNames) - 1)

Sheet1.Range("a1").WrapText = True
Sheet1.Range("a1").Value = CCNames

Unload Me

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

R3df1sh said:
I have a userform with a combo box. I have the combo box enabled to
allow multiple selections. My delima is I want to populate a field or
possibly multiple fields on sheet1 with these selected items. To give a
better understanding the combo list is a list of names I want to
populate on Sheet1 to make a cc: list. This can either be in a single
cell or multiple, just I have had no luck with coding it.

Thanks in advance for any help you can provide!


------------------------------------------------



~~Now Available: Financial Statements.xls, a step by step guide to
creating financial statements
 
Back
Top