Try
Private Sub CommandButton2_Click()
Dim N As Long
Dim S As String
With Me.ListBox1
If .ListCount = 0 Then
Exit Sub
End If
For N = 0 To .ListCount - 1
S = S & .List(N) & ","
Next N
End With
S = Mid(S, 1, Len(S) - 1)
ActiveCell.Value = S
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Fri, 20 Feb 2009 12:26:01 -0800, Daystrom
<(E-Mail Removed)> wrote:
>Probably this is a stupid question, but the closest answer I can find
>anywhere is Debra Dagleish's code that allows for consecutive selections from
>a data-validation dropdown to be entered in a cell, separated by commas. For
>a few reasons I'd rather do something with a ListBox in a UserForm.
>
>On the UserForm is a ListBox (called ListBox2) which can contain any number
>of items. When a user clicks a button on the UserForm, is it possible to have
>those items, separated by commas, deposited into the Active Cell on the
>current worksheet?
>
>If anyone could help, I'd really appreciate it. I keep finding close
>alternatives to what I need, but nothing that quite hits it, and I'm clearly
>I'm just not smart enough to do this.
>