Private Sub WorkSheet_Activate()
Dim colref%, coldur%, tablo, resu(), d As Object, i&, lig&, n&
colref = 3 'colonne de référence, à adapter
coldur = 10 'colonne des durées, à adapter
tablo = Feuil1.[A7].CurrentRegion.Resize(, coldur)
ReDim resu(1 To UBound(tablo), 1 To 3)
Set d = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(tablo)
If IsDate(tablo(i, coldur)) Then tablo(i, coldur) = CDbl(TimeValue(tablo(i, coldur)))
If Not IsNumeric(tablo(i, coldur)) Then tablo(i, coldur) = 0
If d.exists(tablo(i, colref)) Then
lig = d(tablo(i, colref))
resu(lig, 3) = resu(lig, 3) + tablo(i, coldur)
Else
n = n + 1
d(tablo(i, colref)) = n 'mémorise la ligne
resu(n, 1) = tablo(i, 1)
resu(n, 2) = tablo(i, colref)
resu(n, 3) = tablo(i, coldur)
End If
Next
'---restitution---
If FilterMode Then ShowAllData 'si la feuille est filtrée
With [A2] 'cellule à adapter
If d.Count Then .Resize(n, 3) = resu
.Offset(d.Count).Resize(Rows.Count - d.Count - .Row + 1, 3).ClearContents 'RAZ en dessous
End With
With UsedRange: End With 'actualise la barre de défilement verticale
End Sub