Sub Diagonales()
Dim plage As Range
Set plage = [H2:Y18]
plage.Borders(xlDiagonalUp).LineStyle = xlNone 'RAZ
plage.Borders(xlDiagonalDown).LineStyle = xlNone
plage.Font.ColorIndex = xlAutomatic
Analyse plage, Union(plage.Columns(1), plage.Rows(1)), 1
Analyse plage, Union(plage.Rows(1), plage.Columns(plage.Columns.Count)), -1
End Sub
Sub Analyse(plage As Range, zone As Range, sens As Integer)
Dim c As Range, diag As Range, i&, c1 As Range, flag As Boolean
For Each c In zone
Set diag = c
i = 0
Set c1 = Nothing
flag = False
Do While Not Intersect(c.Offset(i, sens * i), plage) Is Nothing
Set diag = Union(c.Offset(i, sens * i), diag)
If c.Offset(i, sens * i) = "X" Then
If c1 Is Nothing Then Set c1 = c.Offset(i, sens * i) Else flag = True
End If
i = i + 1
Loop
If flag Then
diag.Borders(IIf(sens = 1, xlDiagonalDown, xlDiagonalUp)).Weight = xlThin
c1.Font.ColorIndex = 3 'rouge
End If
Next
End Sub