Below I have 2 sets of VBA code for hiding columns and hiding rows. Both work great, but only the hide column portion works when added together. What am I doing wrong? Thanks for the help!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cCell As Range
If Target.Address <> Range("C64").Address Then Exit Sub
Application.ScreenUpdating = False
For Each cCell In Range("K1:AZ1")
cCell.EntireColumn.Hidden = (cCell.Value < Target.Value)
Next
Application.ScreenUpdating = True
Dim rCell As Range
If Target.Address <> Range("C65").Address Then Exit Sub
Application.ScreenUpdating = False
For Each rCell In Range("I1:I57")
rCell.EntireRow.Hidden = (rCell.Value = Target.Value)
Next
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cCell As Range
If Target.Address <> Range("C64").Address Then Exit Sub
Application.ScreenUpdating = False
For Each cCell In Range("K1:AZ1")
cCell.EntireColumn.Hidden = (cCell.Value < Target.Value)
Next
Application.ScreenUpdating = True
Dim rCell As Range
If Target.Address <> Range("C65").Address Then Exit Sub
Application.ScreenUpdating = False
For Each rCell In Range("I1:I57")
rCell.EntireRow.Hidden = (rCell.Value = Target.Value)
Next
Application.ScreenUpdating = True
End Sub