ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating Sheet Data From A UserForm Combo Box Enabled For Multi-Choices (https://www.excelbanter.com/excel-programming/284345-populating-sheet-data-userform-combo-box-enabled-multi-choices.html)

R3df1sh[_3_]

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

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!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

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

Dick Kusleika[_3_]

Populating Sheet Data From A UserForm Combo Box Enabled For Multi-Choices
 
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" wrote in message
...

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!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements




All times are GMT +1. The time now is 10:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com