• 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.

Concatenate the two column values into other column in Excel VBA

AmitSingh

Member
Hi All,

Please help to concatenate the two column values into other column. I have used below function but only one UIN (column name) is appearing in column Y of Reporting Structure. Need to bring two column value, first value from column W of Line Manager UIN and followed by column A of UIN.
In excel i have done with this formula i.e. =CONCATENATE("x:",[@[Line Manager UIN]],":" & [@UIN]) which gives the result
x:802422055:600124663.
I am attaching the workbook(RSLM.xlsb) with the code in Module1 and also the output file (Output_RSLM.xlsb) which i need in column Y of Reporting Structure.

Any help is appreciated as this little urgent. Thanks in advance.



Code:
Function ReportingStructure(UIN As String, UINRng As Range, LMUINRng As Range) As String
'=======================================================================================
Dim c As Variant
Dim LMUIN As String
Set c = UINRng.Find(What:=UIN, LookIn:=xlValues, LookAt:=xlWhole)
If c Is Nothing Then
ReportingStructure = "X:" & UIN
Else
LMUIN = Application.Intersect(c.EntireRow, LMUINRng).Value
ReportingStructure = ReportingStructure(LMUIN, UINRng, LMUINRng) & ":" & UIN
End If
End Function
 

Attachments

Last edited by a moderator:
Top