CONCATENATE on separated values
I think that I can merge your macro with my userform to get what I
need.
Here is what I have. I know that I have variables that I don't need.
Private Sub OK_exp_Click()
Dim CellRange As Range
Dim CellCnt As Integer
Dim r As Integer
Dim x As Range
Dim w As String
Dim y As Range
Dim z As Range
Dim sbuf As String
w = ", "
CellCnt = 0
For r = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(r) Then
CellCnt = CellCnt + 1
If CellCnt = 1 Then
Set CellRange = ActiveSheet.UsedRange.Cells(r + 1)
Else
Set CellRange = Union(CellRange,
ActiveSheet.UsedRange.Cells(r + 1))
End If
End If
Next r
For Each y In CellRange
If Len(y.Text) 0 Then sbuf = sbuf & y.Text & w
Next
z = Left(sbuf, Len(sbuf) - 1)
Unload Me
End Sub
Right now it is showing me the error on the z= left... line.
I think that my address for pasting the code into a cell is wrong. Can
you help me.
|