Private Sub UserForm_Initialize()
Dim Total As Date
Dim E1 As Date, S1 As Date, E2 As Date, S2 As Date, AEntree As Date, Asortie As Date
E1 = CDate(Range("a2").Text)
S1 = CDate(Range("b2").Text)
E2 = CDate(Range("c2").Text)
S2 = CDate(Range("d2").Text)
AEntree = CDate(Range("e2").Text)
Asortie = CDate(Range("f2").Text)
If AEntrée < E1 Then
If Asortie < E1 Then
Total = Asortie - AEntree
If Asortie > E1 Then
Total = E1 - AEntree
End If
If AEntree < S1 Then
If Asortie > S1 Then
Total = Total + (S1 - AEntree)
End If
End If
End If
End If