hello,
im trying to consolidate my data that have two headers, one under another and then the data in the same column.
i want that if the two headers are matching other two headers, to combine them to a single column.
i tried to improve this code but had no luck.
please help me
im trying to consolidate my data that have two headers, one under another and then the data in the same column.
i want that if the two headers are matching other two headers, to combine them to a single column.
i tried to improve this code but had no luck.
VBA Code:
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
please help me