'-------------- Test doublons -------------
For i = 2 To (Range("A65536").End(xlUp).Row - rg.Row) Step 1
VarA = Cells(i, 1).Value
VarB = Cells(i, 2).Value
VarC = Cells(i, 3).Value
VarDateD = Cells(i, 5).Value
VarDateF = Cells(i, 6).Value
j = i + 1
k = j
If VarA <> "" And VarA = Cells(j, 1).Value Then
Do While VarA = Cells(j, 1).Value
If VarB <> "" And VarB = Cells(j, 2).Value Then
Do While VarA = Cells(k, 1).Value And VarB = Cells(k, 2).Value
If VarC = "" And Cells(k, 3).Value <> "" Then
Cells(j, 1).Interior.Pattern = xlLightHorizontal ' met un motif dans la cellule
Cells(j, 1).Interior.PatternColorIndex = 39 ' met une couleur lavande
Cells(i, 1).Interior.Pattern = xlLightHorizontal ' met un motif dans la cellule
Cells(i, 1).Interior.PatternColorIndex = 39 ' met une couleur lavande
ElseIf VarC <> "" And VarC = Cells(j, 3).Value Then
If Cells(j, 5).Value > VarDateD And Cells(j, 5).Value < VarDateF Or _
Cells(j, 6).Value > VarDateD And Cells(j, 6).Value < VarDateF Then
Cells(j, 1).Interior.Pattern = xlLightHorizontal ' met un motif dans la cellule
Cells(j, 1).Interior.PatternColorIndex = 39 ' met une couleur lavande
Cells(i, 1).Interior.Pattern = xlLightHorizontal ' met un motif dans la cellule
Cells(i, 1).Interior.PatternColorIndex = 39 ' met une couleur lavande
End If
End If
k = k + 1
Loop
ElseIf VarB = "" And Cells(j, 2).Value <> "" Then
Cells(j, 1).Interior.Pattern = xlLightHorizontal ' met un motif dans la cellule
Cells(j, 1).Interior.PatternColorIndex = 39 ' met une couleur lavande
Cells(i, 1).Interior.Pattern = xlLightHorizontal ' met un motif dans la cellule
Cells(i, 1).Interior.PatternColorIndex = 39 ' met une couleur lavande
ElseIf VarB = Cells(j, 2) And VarC = Cells(j, 3) Then
If Cells(j, 5).Value > VarDateD And Cells(j, 5).Value < VarDateF Or _
Cells(j, 6).Value > VarDateD And Cells(j, 6).Value < VarDateF Then
Cells(j, 1).Interior.Pattern = xlLightHorizontal ' met un motif dans la cellule
Cells(j, 1).Interior.PatternColorIndex = 39 ' met une couleur lavande
Cells(i, 1).Interior.Pattern = xlLightHorizontal ' met un motif dans la cellule
Cells(i, 1).Interior.PatternColorIndex = 39 ' met une couleur lavande
End If
End If
j = j + 1
Loop
End If
Next i