Jonnathanjons
Member
Hello Dear ,
Could you please help me in concatenating the columns based on Column name and not by specific range as the data keep changing every week.
Result should be in the Column "Billing" This column should be created after last available column provided.
This is the input file
Result should be like this
Below is the vb script I wrote so far.
Could you please help me in concatenating the columns based on Column name and not by specific range as the data keep changing every week.
Result should be in the Column "Billing" This column should be created after last available column provided.
This is the input file
Result should be like this
Below is the vb script I wrote so far.
>>> You've already noted <<<
>>> use code - tags <<<
>>> use code - tags <<<
Code:
Sub concat()
Dim Counter As Integer
Dim Bill As Variant
Dim Lab As Variant
Dim Ops As Variant
Dim Fin As Variant
Set ws = ActiveSheet
Rows(1).Find("*", , xlValues, , xlByColumns, xlPrevious).Offset(, 1).Value = ">>"
Rows(1).Find("*", , xlValues, , xlByColumns, xlPrevious).Offset(, 1).Value = "Billing"
Set Bill = Rows("1:1").Find("Billing", , xlValues, xlWhole, , , True).Offset(1, 0)
Set Lab = Rows("1:1").Find("Lab", , xlValues, xlWhole, , , True)
Set Ops = Rows("1:1").Find("Operations", , xlValues, xlWhole, , , True)
Set Fin = Rows("1:1").Find("Finance", , xlValues, xlWhole, , , True)
For Counter = 2 To WorksheetFunction.CountA(Range("A:A"))
Range(Bill & Counter) = Range(Lab & Counter) & "-" & Range(Ops & Counter) & "-" & Range(Fin & Counter)
'Range("G" & Counter) = Range("C" & Counter) & "-" & Range("D" & Counter) & "-" & Range("E" & Counter)
Next Counter
End Sub
Attachments
Last edited by a moderator: