Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Single, C As Range
If Target.Address <> "$B$6" Then Exit Sub
Application.DisplayAlerts = 0
With [A6:A36]
.UnMerge
.Value = [O6:O36].Value
.Interior.ColorIndex = xlNone
For i = 36 To 6 Step -1
If Cells(i - 1, 1) = Cells(i, 1) Then
If C Is Nothing Then
Set C = Application.Union(Cells(i - 1, 1), Cells(i, 1))
Else
Set C = Application.Union(C, Cells(i - 1, 1))
C.Interior.ColorIndex = IIf(Cells(i, 1) Mod 2 = 0, 5, 8)
End If
Else
If Not C Is Nothing Then C.Merge False
Set C = Nothing
End If
Next
.VerticalAlignment = xlCenter ' pour faire zouli
End With
Application.DisplayAlerts = 1
End Sub