Add this code to your VB editor (Alt+F11, Insert|Module)
Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant
If TypeOf a Is Range Then
For Each y In a.Cells
aconcat = aconcat & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
aconcat = aconcat & y & sep
Next y
Else
aconcat = aconcat & a & sep
End If
aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function
Then apply formula in a separate column
=SUBSTITUTE(TRIM(aconcat(A1:A501," "))," ",",")
You can then copy this and paste special >> Values over itself to make it a hard-coded string.
Bookmarks