Sub colorer()
Dim xrg As Range, t, max, ref, n&, j&, plage As Range, coul
Set xrg = Range("a1:j1"): t = xrg.Value
xrg.Interior.ColorIndex = xlColorIndexAutomatic
max = 0: ref = t(1, 1): n = 1
For j = 2 To UBound(t, 2)
If t(1, j) = ref Then
n = n + 1
Else
If n > max Then max = n
n = 1: ref = t(1, j)
End If
Next j
If n > max Then max = n
n = 0
Do
Set plage = xrg.Offset(, n).Resize(, max)
If Application.CountIf(plage, plage(1, 1)) = max Then
plage.Interior.Color = IIf(coul Mod 2 = 0, vbYellow, vbGreen): coul = coul + 1
n = n + max
Else
n = n + 1
End If
If n > xrg.Count - 1 Then Exit Do
Loop
End Sub