I have the following code where the cell equal to 1,2,3,4 and etc where the cell 54 to 103 should collapse accordingly. My code is as follow
Private Sub Worksheet_Change(ByVal Target As Range)
Rows("54:103").EntireRow.Hidden = False
x = Range("A29").Value
Select Case x
Case ""
Rows("54:103").EntireRow.Hidden = True
Case 1 To 49
Rows(54 + x & ":103").EntireRow.Hidden = True
Case 50
Rows("103:104").EntireRow.Hidden = False
End Select
End If
Application.ScreenUpdating = True
End Sub
I need a subsequent code where cell B9="APPLE", row 5 till 20 and row 27:100 should collpase
and when B9="Orange", row 3 till 20 and row 30-50 should collapse
Private Sub Worksheet_Change(ByVal Target As Range)
Rows("54:103").EntireRow.Hidden = False
x = Range("A29").Value
Select Case x
Case ""
Rows("54:103").EntireRow.Hidden = True
Case 1 To 49
Rows(54 + x & ":103").EntireRow.Hidden = True
Case 50
Rows("103:104").EntireRow.Hidden = False
End Select
End If
Application.ScreenUpdating = True
End Sub
I need a subsequent code where cell B9="APPLE", row 5 till 20 and row 27:100 should collpase
and when B9="Orange", row 3 till 20 and row 30-50 should collapse