Option Explicit
Sub CpyData()
Dim nlm&, dl1&: nlm = Rows.Count
dl1 = Cells(nlm, 6).End(3).Row: If dl1 = 1 Then Exit Sub
Dim key1 As Range, id1$, id2$
Dim chn$, dl2&, lg2&, lg1&, b1 As Byte, b2 As Byte
dl2 = Cells(nlm, 1).End(3).Row: Application.ScreenUpdating = 0
For lg1 = 2 To dl1
Set key1 = Cells(lg1, 6)
If key1 <> "" Then
id1 = key1.Offset(, 1)
If id1 <> "" Then
b1 = 0: b2 = 0
For lg2 = 2 To dl2
If Cells(lg2, 1) = key1 Then
b1 = 1: id2 = Cells(lg2, 2): If id2 = id1 Then b2 = 1
End If
Next lg2
If b1 = 1 And b2 = 0 Then
dl2 = dl2 + 1
With Cells(dl2, 1)
.Value = key1: .Offset(, 1) = id1
If Left$(id2, 4) = Left$(id1, 4) Then
chn = "Impact Majeur"
If Mid$(id2, 5, 1) = Mid$(id1, 5, 1) Then Mid$(chn, 9, 2) = "in"
.Offset(, 2) = chn
End If
With .Resize(, 3)
.HorizontalAlignment = 1: .IndentLevel = 1: .Borders.LineStyle = 1
End With
End With
End If
End If
End If
Next lg1
End Sub