Option Explicit
Const codCoch = 254, codDecoch = 168, Police = "Wingdings"
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count = 1 Then LigneType Target
End Sub
Sub LigneType(cible As Range)
Dim lig&, col&
lig = cible.Row: col = cible.Column
If lig >= 10 And lig <= 17 And (col = Range("i1").Column Or col = Range("n1").Column) Then
Union(Cells(lig, "i"), Cells(lig, "n")) = Chr(codDecoch)
Cells(lig, col) = Chr(codCoch)
Application.EnableEvents = False: Cells(lig + 1, 1).Activate: Application.EnableEvents = True
ElseIf lig = 18 And (col = Range("i1").Column Or col = Range("L1").Column Or col = Range("O1").Column Or col = Range("r1").Column) Then
Union(Cells(lig, "i"), Cells(lig, "L"), Cells(lig, "O"), Cells(lig, "r")) = Chr(codDecoch)
Cells(lig, col) = Chr(codCoch)
Application.EnableEvents = False: Cells(lig + 1, 1).Activate: Application.EnableEvents = True
ElseIf (lig >= 22 And lig <= 27) Or (lig >= 29 And lig <= 32) Or (lig >= 34 And lig <= 36) Then
If (col = Range("j1").Column Or col = Range("m1").Column Or col = Range("p1").Column) Then
Union(Cells(lig, "j"), Cells(lig, "m"), Cells(lig, "p")) = Chr(codDecoch)
Cells(lig, col) = Chr(codCoch)
Application.EnableEvents = False: Cells(lig + 1, 1).Activate: Application.EnableEvents = True
End If
End If
End Sub