Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [F:F]) Is Nothing Then Exit Sub
Dim plage As Range, cel As Range, n1&, n2&, n3&
'---initialisations---
Application.ScreenUpdating = False
Set plage = Range("D1:D" & Application.Max([E65536].End(xlUp).Row, [F65536].End(xlUp).Row))
plage.Clear
[E:G].Borders.LineStyle = xlNone
plage.HorizontalAlignment = xlLeft
'---construction de la colonne D---
For Each cel In plage
With cel.Offset(, 2) 'colonne F
If .Font.Underline = xlSingle Then
If LCase(.Offset(, -1)) = LCase("txLocalisation") Then
cel = n1
cel.Font.ColorIndex = 3
Else
cel = Chr(65 + n1)
n1 = n1 + 1
End If
n2 = 0
cel.Font.FontStyle = "Gras"
cel.Borders(xlEdgeTop).LineStyle = xlContinuous
ElseIf .Font.FontStyle = "Gras" And .Font.Underline = xlNone Then
n2 = n2 + 1
n3 = 1
cel = Chr(64 + n1) & n2 & ".1"
cel.Font.FontStyle = "Gras"
cel.Font.ColorIndex = 3
cel.Resize(, 4).Borders(xlEdgeTop).LineStyle = xlContinuous
Else
n3 = n3 + 1
cel = Chr(64 + n1) & n2 & "." & n3
End If
End With
Next
End Sub