AW: Zellen mit Umschaltbutton ein-/ausblenden
25.04.2019 11:22:40
Werner
Hallo Michi,
so:
Private Sub ToggleButton1_Click()
Dim avntStart As Variant, avntStop As Variant
Dim ialngIndex As Long, objCell As Range
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
With ToggleButton1
If .Value Then
avntStart = Array(13, 69, 125, 181, 237, 293, 349, 405)
avntStop = Array(62, 118, 174, 230, 286, 342, 398, 454)
Application.ScreenUpdating = False
For ialngIndex = LBound(avntStart) To UBound(avntStart)
For Each objCell In Range(Cells(avntStart(ialngIndex), 1), _
Cells(avntStop(ialngIndex), 1))
Rows(objCell.Row).Hidden = IsEmpty(objCell.Value)
Next
Next
Application.ScreenUpdating = True
.Caption = "Einblenden"
Else
Rows.Hidden = False
.Caption = "Ausblenden"
End If
End With
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub
Gruß Werner