Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ac%, rc&, rc1&, rc2&, cc%, cc1%, cc2%, i%, j%
Dim a1 As Range, a2 As Range, ref As Range, sel As Range
Static memsel As Range 'variable mémorisée
Set Inter = Nothing 'réinitialisation de la variable Public
If t Then Application.OnTime t, "Clignote", , False 'arrête le clignotement
t = 0
ac = Target.Areas.Count: rc = Rows.Count: cc = Columns.Count
For i = 1 To ac
Set a1 = Target.Areas(i)
rc1 = a1.Rows.Count: cc1 = a1.Columns.Count
If rc1 = rc And cc1 = 1 Or rc1 = 1 And cc1 = cc Then _
Set sel = Union(IIf(sel Is Nothing, a1, sel), a1)
For j = i + 1 To ac
Set a2 = Target.Areas(j)
rc2 = a2.Rows.Count: cc2 = a2.Columns.Count
If rc1 = 1 And cc1 = cc And rc2 = rc And cc2 = 1 Or _
rc1 = rc And cc1 = 1 And rc2 = 1 And cc2 = cc Then
Set ref = Intersect(a1, a2)
If ref <> "" Then Set Inter = Union(IIf(Inter Is Nothing, ref, Inter), ref)
End If
Next
Next
If ac = 1 And Not memsel Is Nothing Then
Application.ScreenUpdating = False
Cells.FormatConditions.Delete
[A1:AA1].FormatConditions.Add xlCellValue, xlGreater, 1
[A1:AA1].FormatConditions(1).Font.ColorIndex = 3 'rouge
'[A1:AA1].FormatConditions(1).Font.Bold = True 'gras 'inutile...
End If
Set memsel = sel 'mémorise
If Not sel Is Nothing Then
Application.ScreenUpdating = False
sel.FormatConditions.Delete
sel.FormatConditions.Add xlExpression, Formula1:="=OU(LIGNE()=1;COLONNE()=28)"
sel.FormatConditions(1).Interior.ColorIndex = 3 'rouge
sel.FormatConditions(1).Font.ColorIndex = 2 'blanc
sel.FormatConditions(1).Font.Bold = True 'gras
sel.FormatConditions.Add xlExpression, Formula1:=True
sel.FormatConditions(2).Interior.ColorIndex = 1 'noir
sel.FormatConditions(2).Font.ColorIndex = 2 'blanc
sel.FormatConditions(2).Font.Bold = True 'gras
End If
If Not Inter Is Nothing Then
Inter.FormatConditions.Delete '2 lignes inutiles sur Excel 2003
Inter.FormatConditions.Add xlExpression, Formula1:=True
Inter.FormatConditions(1).Font.Bold = True 'gras
'---clignotement---
Clignote
End If
End Sub