Hallo,
ok, if you're still with me, then...;-)... probier mal:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim objRange1 As Range, objRange2 As Range, objCell As Range
Dim lngStep As Long
Set objRange1 = Range(Cells(4, 4), Cells(9, 4))
Set objRange2 = Range(Cells(5, 5), Cells(9, 5))
If Not Intersect(Target, objRange1) Is Nothing Then
For Each objCell In objRange1
With Tabelle2
.Range(.Columns(objCell.Row + 5 + lngStep), .Columns(objCell.Row + 7 + lngStep)).EntireColumn.Hidden = objCell.Value = vbNullString
End With
lngStep = lngStep + 3
Next
ElseIf Not Intersect(Target, objRange2) Is Nothing Then
For Each objCell In objRange2
With objCell
Columns(.Row).EntireColumn.Hidden = Not IsEmpty(.Value) And .Value = 0
End With
Next
End If
Set objRange1 = Nothing
Set objRange2 = Nothing
End Sub
Gruß,
|