03.06.2022, 13:06
Ok. Für Zelle als Button hatte ich das jetzt schon fertig. Ein einfach Klick geht da aber nicht. Wie du A1:C1 beschriftest ist egal.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim j As Long
If Target.Address = "$A$1" Then
Cells.Rows.Hidden = False
Range("B1").Font.Color = RGB(255, 255, 255)
Range("C1").Font.Color = RGB(255, 255, 255)
Cancel = True
End If
If Target.Address = "$B$1" Then
ActiveSheet.UsedRange.Rows.Hidden = True
For j = 1 To UsedRange.Rows.Count
If j = 1 Or Cells(j, 1).Value = "E" Or Cells(j, 1).Value = "!" Then Cells.Rows(j).Hidden = False
Next j
ActiveWindow.ScrollRow = 1
Range("B1").Font.Color = RGB(255, 0, 98)
Range("C1").Font.Color = RGB(255, 255, 255)
Cancel = True
End If
If Target.Address = "$C$1" Then
ActiveSheet.UsedRange.Rows.Hidden = True
For j = 1 To UsedRange.Rows.Count
If j = 1 Or Cells(j, 1).Value = "W" Or Cells(j, 1).Value = "!" Then Cells.Rows(j).Hidden = False
Next j
ActiveWindow.ScrollRow = 1
Range("C1").Font.Color = RGB(255, 0, 98)
Range("B1").Font.Color = RGB(255, 255, 255)
Cancel = True
End If
End Sub