Sub Version2()
Dim a, b(), i As Long, txt As String
Dim e, n As Long, Fin As Long
Fin = Application.InputBox("Choisir l'année.", , 2015, Type:=1)
Fin = Fin - 1999
Application.ScreenUpdating = False
With Sheets("Sheet1").Range("A1").CurrentRegion
a = .Value
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 2 To UBound(a, 1)
.Item(a(i, 1)) = a(i, 2)
Next
ReDim b(1 To .Count * Fin, 1 To UBound(a, 2) + 1)
For Each e In .keys
For i = 1 To Fin
n = n + 1
.Item(e & i + 1999) = n
b(n, 1) = e: b(n, 2) = .Item(e): b(n, 3) = i + 1999
Next
Next
For i = 2 To UBound(a, 1)
txt = a(i, 1) & a(i, 3)
If .exists(txt) Then
b(.Item(txt), 2) = a(i, 2)
b(.Item(txt), 4) = a(i, 4)
b(.Item(txt), 5) = "x"
End If
Next
End With
With .Offset(, .Columns.Count + 1)
.CurrentRegion.Clear
.Resize(, UBound(a, 2)).Value = a
.Offset(1).Resize(n, UBound(b, 2)).Value = b
With .CurrentRegion
With .Rows(1)
.Cells(5).Value = "Existant"
.Font.Bold = True
.Interior.ColorIndex = 45
.BorderAround Weight:=xlThin
End With
.Font.Name = "calibri"
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlCenter
.Borders(xlInsideVertical).Weight = xlThin
.BorderAround Weight:=xlThin
.Columns.AutoFit
End With
End With
End With
Application.ScreenUpdating = True
End Sub