Sub Macro1()
Dim x, y As Long
Dim lenTab1, lenTab2 As Long
Dim couleur1, couleur2 As Integer
lenTab1 = Sheets("Feuil1").Cells(Rows.Count, 1).End(xlUp).Row
lenTab2 = Sheets("Feuil2").Cells(Rows.Count, 1).End(xlUp).Row
couleur1 = 3
couleur2 = 5
Sheets("Feuil3").Select
For y = 2 To lenTab1
Cells(y, 1) = Sheets("Feuil1").Cells(y, 1)
Cells(y, 2) = Sheets("Feuil1").Cells(y, 2)
Cells(y, 4) = Sheets("Feuil1").Cells(y, 3)
Cells(y, 6) = Sheets("Feuil1").Cells(y, 4)
Cells(y, 8) = Sheets("Feuil1").Cells(y, 5)
Next y
For y = lenTab1 + 2 To lenTab1 + lenTab2
Cells(y - 1, 1) = Sheets("Feuil2").Cells(y - lenTab1, 1)
Cells(y - 1, 3) = Sheets("Feuil2").Cells(y - lenTab1, 2)
Cells(y - 1, 5) = Sheets("Feuil2").Cells(y - lenTab1, 3)
Cells(y - 1, 7) = Sheets("Feuil2").Cells(y - lenTab1, 4)
Cells(y - 1, 9) = Sheets("Feuil2").Cells(y - lenTab1, 5)
Next y
' On trie par dates
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
' On met la première ligne en rouge pour initialiser
Range("A2:I2").Interior.ColorIndex = couleur1
For y = 2 To lenTab1 + lenTab2 - 1
If Cells(y, 1) <> Cells(y - 1, 1) Then
If Cells(y - 1, 1).Interior.ColorIndex = couleur1 Then
Range("A" & y & ":" & "I" & y).Interior.ColorIndex = couleur2
Else
Range("A" & y & ":" & "I" & y).Interior.ColorIndex = couleur1
End If
Else
Range("A" & y & ":" & "I" & y).Interior.ColorIndex = Cells(y - 1, 1).Interior.ColorIndex
End If
Next y
End Sub