I can't get my head around this.
I have a data structure like this:

I would like to end up with something like this (in another sheet).

If column E is equivalent to 2, then the row should be copied to the other sheet, and the row with the same ID (Column A) the name in that row should be inserted in the final row.
Actually, I'm trying to merge/combine 2 rows, as seen in the picture, such that each ID number is only represented once in Sheet2.
Sub Test()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sheet1")
Dim i As Integer
Dim last_row As Integer
last_row = Application.WorksheetFunction.CountA(sh.Range("A:A"))
For i = 2 To last_row
If sh.Range("D" & i).Value = 2 Then
sh.Range("A1:G3").Copy _
Worksheets("sheet2").Range("A1")
End If
Next i
End Sub
For now, I can only copy a range. And then I'm confused by which order to do the subtasks.