I need help with a VB code to merge columns with same header. i got this code from net but not suiting my need.
I have attached a file with expected results. Any help is greatly appreciated.
Sub ConsolidateColumns()
Dim Rg As Range
Application.ScreenUpdating = False
With [A1].CurrentRegion
For C& = 2 To .Columns.Count
P& = Application.Match(.Cells(C).Value, .Rows(1), 0)
If P < C Then
Set Rg = .Cells(C)
Do
Set Rg = Intersect(.Columns(C), Rg.End(xlDown))
If Not Rg Is Nothing Then Rg.Copy Cells(Rg.Row, P)
Loop Until Rg Is Nothing
.Columns(C).Clear
End If
Next C
End With
Application.ScreenUpdating = True
End Sub
Thanks
Shreeja
Bookmarks