Hello,
I opened a thread with this topic.Dear Jindon had written a code with the subject.
But I couldn't find my thread link.
Dear Jindon, would you look again? I had to reopen the issue.
I marked the issue as resolved.I unchecked it because there was an error.I opened this thread again because I couldn't find the link.
I'm sorry if I did something wrong
Sub test()
' jindon
Dim a, b, i As Long, n As Long, t As Long, txt As String
With Sheets("price").Cells(1).CurrentRegion
a = Application.Index(.Value, Evaluate("row(2:" & .Rows.Count & ")"), [{3,7,14,12,15}])
End With
ReDim b(1 To UBound(a, 1), 1 To UBound(a, 1))
With CreateObject("Scripting.Dictionary")
For i = 2 To UBound(a, 1)
txt = Join(Array(a(i, 1), a(i, 2)), Chr(2))
If Not .exists(txt) Then
.Item(txt) = Array(.Count + 1, 2)
b(.Item(txt)(0), 1) = a(i, 1)
b(.Item(txt)(0), 2) = a(i, 2)
End If
b(.Item(txt)(0), .Item(txt)(1) + 1) = Join(Array(a(i, 3), a(i, 4), a(i, 5)), " ; ")
.Item(txt) = Array(.Item(txt)(0), .Item(txt)(1) + 1)
If t < .Item(txt)(1) Then t = .Item(txt)(1)
Next
i = .Count
End With
With Sheets("summary").Cells(1).Resize(, UBound(a, 2))
.Value = a
.Cells(1, 3).Resize(, t - 2) = .Cells(1, 3)
.Rows(2).Resize(i, t) = b
End With
End Sub
Bookmarks