Macro to Join Text in Excel


Join Text present in different cells of a Column


Sub JoinStringsInColumn()
Dim XLnCAD As Range, Sonder As Range, XNC As String
Set XLnCAD = Selection
For Each Sonder In XLnCAD
XNC = XNC & " " & Sonder
Next
ActiveCell.Offset(0, 1).Select
Selection.Value = XNC
Selection.Font.Bold = True
End Sub

Join Text in present in different cells of a Row


Sub JoinStringsInRow()
Dim XLnCAD As Range, Sonder As Range, XNC As String
Set XLnCAD = Selection
For Each Sonder In XLnCAD
XNC = XNC & " " & Sonder
Next
ActiveCell.Offset(1, 0).Select
Selection.Value = XNC
Selection.Font.Bold = True
End Sub

How to use codes shared here?