Option Explicit
Private Dic As Dictionary, HDern As Date
Function DateDép(ByVal Nom As String, ByVal RngDon As Range, ByVal Date1 As Date)
If HDern < Now Then InitDic RngDon, Date1
If Dic.Exists(Nom) Then
DateDép = Dic(Nom)(0)
Else: DateDép = "": End If
End Function
Function DateFin(ByVal Nom As String, ByVal RngDon As Range, ByVal Date1 As Date)
If HDern < Now Then InitDic RngDon, Date1
If Dic.Exists(Nom) Then
DateFin = Dic(Nom)(1)
Else: DateFin = "": End If
End Function
Private Sub InitDic(ByVal RngDon As Range, ByVal Date1 As Date)
Dim Cel As Range, Nom As String, TDat(), TDon(), L&, C%, TDF()
Set Dic = New Dictionary
TDon = RngDon.Value
For L = 1 To UBound(TDon, 1)
For C = 1 To UBound(TDon, 2)
Nom = TDon(L, C)
If Nom <> "" Then
If Dic.Exists(Nom) Then
TDF = Dic(Nom)
Else
TDF = Array(#12/31/9999#, 0)
End If
If TDF(0) > Date1 + L - 1 Then TDF(0) = Date1 + L - 1
If TDF(1) < Date1 + L - 1 Then TDF(1) = Date1 + L - 1
Dic(Nom) = TDF
End If
Next C, L
HDern = Now + 1 / 86400
End Sub