Bonjour Rock n'Roll Animal, bonjour le forum,
Tes couleurs sont complètement erronées !...
Une proposition :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim TV As Variant
Dim DD As Variant
Dim DF As Variant
Dim DR As Variant
Dim TL() As Variant
Dim M As Integer
If Target.Count > 1 Or Target.Value = "" Then Exit Sub
If Not Intersect(Target, Range("A5:A" & Cells(Cells.Rows.Count, 1).End(xlUp).Row + 1)) Is Nothing Then
MsgBox ("Une date entrée, recherche de la valeur MAX de la colonne parmis les dates comprises entre la date de début et la date de fin")
End If
TV = Range("A5:B17")
DD = DateSerial(Year([_D]), Month([_D]), Day([_D]))
DF = DateSerial(Year([_F]), Month([_F]), Day([_F]))
J = 1
For I = 1 To UBound(TV, 1)
DR = DateSerial(Year(TV(I, 1)), Month(TV(I, 1)), Day(TV(I, 1)))
If DR >= DD And DR <= DF Then
ReDim Preserve TL(J)
TL(J) = TV(I, 2)
Debug.Print TL(J)
J = J + 1
End If
'DR = Nothing
Next I
M = Application.WorksheetFunction.Max(Application.Index(TL, 0))
Range("B18").Value = M + 1
End Sub