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

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!
 
D

Dick Kusleika

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!
creating financial statements
 

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

Top