Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
If Not Intersect(Target, Columns("L")) Is Nothing Then
Set P = Target.Find("*", Target.Cells(Target.Count), , , xlByColumns, xlNext) 'Première cellule non vide
Set L = Target.Find("*", Target.Cells(1), , , xlByColumns, xlPrevious) 'Dernière cellule non vide
If Not L Is Nothing And Not P Is Nothing Then
For Each Cell In Range(P, L).Cells
Application.EnableEvents = False
Cell = UCase(Cell)
Select Case Cell
Case...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
If Not Intersect(Target, Columns("K")) Is Nothing Then
For Each Cell In Target.Cells
Application.EnableEvents = False
Cell = UCase(Cell)
Select Case Cell
Case "N": Cell.Offset(0, -4) = Cell.Offset(0, -4) + 1
Case "O": Cell.Offset(0, -4) = 0
Case Else: ' Rien
End Select
Application.EnableEvents = True
Next
End If
End Sub
Option Explicit
Sub Essai()
Dim nlm&, n&: nlm = Rows.Count
n = Cells(nlm, 1).End(3).Row: If n = 1 Then Exit Sub
Dim Tbl, ft$, t%, k As Byte, i&: Application.ScreenUpdating = 0
n = n - 1: [G2].Resize(n) = Empty: [K2].Resize(n, 2) = Empty
n = Cells(nlm, 9).End(3).Row: If n = 1 Then Exit Sub
n = n - 1: Tbl = [G2].Resize(n, 6)
For i = 1 To n
ft = Tbl(i, 3)
If ft <> "" Then
k = -(ft = "0 - 0")
Tbl(i, 5) = Chr$(79 - k): Tbl(i, 6) = k
If k = 0 Then t = 0 Else t = t + 1
Tbl(i, 1) = t
End If
Next i
[G2].Resize(n) = Application.Index(Tbl, Evaluate("Row(" & "1:" & n & ")"), 1)
[K2].Resize(n, 2) = Application.Index(Tbl, Evaluate("Row(" & "1:" & n & ")"), _
[Column(E:F)])
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
If Not Intersect(Target, Columns("L")) Is Nothing Then
Set P = Target.Find("*", Target.Cells(Target.Count), , , xlByColumns, xlNext) 'Première cellule non vide
Set L = Target.Find("*", Target.Cells(1), , , xlByColumns, xlPrevious) 'Dernière cellule non vide
If Not L Is Nothing And Not P Is Nothing Then
For Each Cell In Range(P, L).Cells
Application.EnableEvents = False
Cell = UCase(Cell)
Select Case Cell
Case "N": Cell.Offset(0, -5) = Cell.Offset(0, -5) + 1
Case "O": Cell.Offset(0, -5) = 0
Case Else: ' Rien
End Select
Application.EnableEvents = True
Next
End If
End If
End Sub