I am strugggeling with creating a VBA macro, which combines the Data of Columns based on the header.
Example: Example
Output should be: Output (Lemon Values U I O P - wrong in the screenshot)
Also I don't have a fixed range for this data table, which gives me a headache :)
Hope someone can help me out here !
This is what I currently have:
With wb.Sheets("Sheet1").UsedRange
For C = 2 To .Columns.Count
P = Application.Match(.Cells(C), .Rows(1), 0)
If P < C Then
Range(.Cells(2, C), .Cells(C).End(xlDown)).Copy .Cells(P).End(xlDown)(2)
S = IIf(S > "", S & ",", "") & .Cells(C).Address(0, 0)
End If
Next
End With
If S > "" Then Range(S).EntireColumn.Delete