I have a userform in excel that has mutliple selections possible, the issue is I need the selections to go to a single cell in my worksheet. Any help would be much appreciated.
[/FONT]
[FONT=Courier New]Private Sub CommandButton1_Click()
Dim i As Long
For i = 1 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Sheet3.Range("I1").Value = Sheet3.Range("I1").Value & Me.ListBox1.List(i)
End If
Next i
End Sub
Dim i As Long, s As String
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
s = s & ListBox1.List(i) & Chr(10)
End If
Next i
If s <> "" Then Range("A1").Value = Left(s, Len(s) - 1)
Thank you very much for the quick response.
Works great. Have another question, I have two multiple listboxes in my userform and when I add the information to my spreadsheet the data from the first listbox also populates into the second listbox data cell along with that listboxes responds. Again any help would be much appreciated.
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.