You could use a custom function like this. Open the VB editor (Alt + F11), click Insert, Module and use this code.
Function SpecialConcatenate(rnge As Range) As String
Dim r As Long, col As Integer
For c = 1 To rnge.Columns.Count
For r = 1 To rnge.Rows.Count
If rnge.Cells(r, c) <> "" Then
SpecialConcatenate = SpecialConcatenate & _
rnge.Cells(r, c).Value & " "
End If
Next r
Next c
End Function
Now if you use the function "=SpecialConcatenate(A1:A30)" it will return everything within the range separated by a space.
Regards,
Dax.
Have you tried the "Text to Columns" wizard under Data on the menu bar ?
Dave
OzGrid Business Applications
Sub MyJoin()
'assume start of list is A1
Range("A1").Select
Dim MyCell
MyCell = ""
Do While Selection <> ""
MyCell = Selection & " " & MyCell
Selection.Offset(1, 0).Select
Loop
'Cell to output to
Range("B1") = MyCell
Range("B1").Select
End Sub
Was there something wrong with the answer I gave? It allowed the user to select any range, was faster then the other macro given and didn't use text to columns to try and join data in different rows.
Regards,
Dax.
Dax, Your advise is fantastic, I followed your instruction to the letter. Despite the fact that I had never used VBA, I just press Alt+F11 and paste the code onto it, and it works.
Many Thanks
Bijay