Private Sub Worksheet_Change(ByVal Target As Range)
Dim n&, x$, i&, nn&
Set Target = Intersect(Target, [BA:BA], UsedRange)
If Target Is Nothing Then Exit Sub
If Target.Count > 1 Or Target(1).EntireRow.Hidden Then
    Application.EnableEvents = False 'désactive les évènements
    Application.Undo
    Application.EnableEvents = True 'réactive les évènements
    Exit Sub
End If
Target.Select
n = Abs(Int(Val(Target)))
x = Application.Trim(LCase(Cells(Target.Row, "AS"))) 'SUPPRESPACE
Application.ScreenUpdating = False
If x Like "*principal*" Then
    i = Application.Match(Application.Max([A:A]), [A:A], 0)
    i = i + Application.Match("S/TOTAL*", Cells(i + 1, 1).Resize(10000), 0)
    Rows(Target.Row + 2 & ":" & i).Hidden = True 'masque
    If n Then
        i = Application.Match(Application.Min(n, Application.Max([A:A])), [A:A], 0)
        i = i + Application.Match("S/TOTAL*", Cells(i + 1, 1).Resize(10000), 0)
        Rows(Target.Row & ":" & i).Hidden = False 'affiche
    End If
ElseIf x Like "*des item*" Then
    i = Target.Row + Application.Match("S/TOTAL*", Cells(Target.Row + 1, 1).Resize(10000), 0)
    Rows(Target.Row + 3 & ":" & i - 1).Hidden = True 'masque
    If n Then
        x = "*sous item*"
        For i = Target.Row + 1 To 10000
            If LCase(Cells(i, "AS")) Like x Then nn = nn + 1
            If nn = n + 1 Or UCase(Cells(i, 1)) Like "S/TOTAL*" Then Exit For
        Next
        Rows(Target.Row & ":" & i - 1).Hidden = False 'affiche
    End If
ElseIf x Like "*sous item*" Then
    x = "*sous item*"
    For i = Target.Row + 1 To 10000
        If LCase(Cells(i, "AS")) Like x Or UCase(Cells(i, 1)) Like "S/TOTAL*" Then Exit For
    Next
    With Rows(Target.Row + 1 & ":" & i - 1)
        .Hidden = True 'masque
        If n Then .Resize(IIf(n > .Rows.Count, .Rows.Count, n)).Hidden = False 'affiche
    End With
End If
Application.ScreenUpdating = True
End Sub