Sub Calcul()
Dim c As Range, tablo, deb&, i&, j&
Application.ScreenUpdating = False
With [A1].CurrentRegion
'---convertit les textes en dates- en colonnes D et E---
On Error Resume Next
For Each c In .Columns(4).Resize(, 2).SpecialCells(xlCellTypeConstants, 2) '
c = CDate(c)
Next c
On Error GoTo 0
'---tri sur les matricules et les dates---
.Sort .Columns(1), xlAscending, .Columns(4), , xlAscending, .Columns(5), xlAscending, Header:=xlYes
'---analyse du tableau---
tablo = .Resize(.Rows.Count + 1, 10) 'matrice, plus rapide, 1 ligne de plus
deb = 2
For i = 3 To UBound(tablo)
If tablo(i, 1) <> tablo(i - 1, 1) Or tablo(i, 4) <> tablo(i - 1, 5) + 1 Then
For j = deb To i - 1
tablo(j, 8) = tablo(deb, 4) 'pour la colonne H
tablo(j, 9) = tablo(i - 1, 5) 'pour la colonne I
Next j
deb = i
End If
Next i
'---restitution---
.Resize(, 10) = tablo
End With
End Sub