Hi,

I need to enhance this. The destination cell should have a commar separating each cell merged with no spaces.

For e.g.

Cells:
A1: APPLE
A2: ORANGE
A3: MANGO


Results (to merge A1:A3) is APPLE,ORANGE,MANGO (with commar and no spaces)

Would anyone be able to help?

Thank you.


PHP Code: 
Sub JoinCells()

Set xJoinRange Application.InputBox(prompt:="Highlight source cells to merge"Type:=8)
xSource 0
xSource 
xJoinRange.Rows.Count
xType 
"rows"
If xSource 1 Then
    xSource 
xJoinRange.Columns.Count
    xType 
"columns"
End If
Set xDestination Application.InputBox(prompt:="Highlight destination cell"Type:=8)
If 
xType "rows" Then
    temp 
xJoinRange.Rows(1).Value
    
For 2 To xSource
        temp 
temp " " xJoinRange.Rows(i).Value
    Next i
Else
    
temp xJoinRange.Columns(1).Value
    
For 2 To xSource
        temp 
temp " " xJoinRange.Columns(i).Value
    Next i
End 
If

xDestination.Value temp

End Sub