Private Sub Worksheet_Change(ByVal Target As Range)
Dim H1, H2
If Not Intersect(Target, Union(Range("D1"), Range("B2"))) Is Nothing Then
H1 = Range("D1")
If H1 <> "" Then
Application.EnableEvents = False
H2 = Range("B2")
Call Skrývání_sloupců_a_řádků(H1, H2)
Application.EnableEvents = True
End If
End If
End Sub
Private Sub Skrývání_sloupců_a_řádků(H1, H2)
With Sheets(4)
If H1 = 1 Then
.Rows(1).Hidden = True
.Rows(2).Hidden = False
.Columns(2).Hidden = False
Else
If H1 = 2 Then
.Rows(1).Hidden = False
.Rows(2).Hidden = True
.Columns(2).Hidden = (H2 = True)
End If
End If
End With
End Subcitovat