Если вам не очень подходит стандартная группировка Excel, то можно попробовать так
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column > 1 Then Exit Sub
If Target.count > 1 Then Exit Sub
If (Target <> "-") * (Target <> "+") Then Exit Sub
Dim i As Long: Application.EnableEvents = False
With Target.CurrentRegion.Columns(1)
With .SpecialCells(2)
For i = 1 To .Areas.count
If .Areas.Item(i).Address = Target.Address Then Exit For
Next
End With
.SpecialCells(4).Areas.Item(i).EntireRow.Hidden = Target = "-"
End With
Application.EnableEvents = True
Target.Value = IIf(Target = "+", "-", "+")
End Sub
|