• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Put Formula

Abhijeet

Active Member
Hi

I have Numbers in Column A i want concatenate the cells i show in attach file how to do this in macro please tell me
 

Attachments

  • Put Formula.xlsx
    8.5 KB · Views: 0
Probably a UDF....

Code:
Public Function myJoin(a As Variant) As String
Dim sep As String: sep = "-"
   
    Dim y As Variant
    If TypeOf a Is Range Then
        For Each y In a.Cells
            myJoin = myJoin & y.Value & sep
        Next y
    ElseIf IsArray(a) Then
        For Each y In a
            myJoin = myJoin & y & sep
        Next y
    Else
        myJoin = myJoin & a & sep
    End If
    myJoin = Left(myJoin, Len(myJoin) - Len(sep))
End Function
 

Attachments

  • Put Formula.xlsm
    13.9 KB · Views: 0
Back
Top