totesbotes
New Member
- Joined
- Jan 29, 2022
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
I am trying to do a user input whereby there are 2 inputs cell A1 and cell B1 on the same worksheet. For actions of cell A1, my code is as follows:
For actions of cell A2,my code is as follows:
Currently, I face the problem that when I change A1 to Hide1, Row 3-5 will hide but unhide immediately when I change A2 to Hide 3 while Row 11-13 gets hidden only.
How do I make sure that after changing A1, Row 3-5 continue to be hidden even after I change A2? E.g. I change A1 to "Hide 1", Rows 3-5 gets hidden. Next, I change A2 to "Hide 3", I want Rows 11-13 gets hidden while Rows 3-5 continues to get hidden.
VBA Code:
If target.Address = "$A$1" Then
Select Case Sheets("Input").Range("A1")
Case "Hide1"
Range("A3:A5").EntireRow.Hidden = True
Case "Hide2"
Range("A7:A9").EntireRow.Hidden = True
End Select
End If
For actions of cell A2,my code is as follows:
VBA Code:
If target.Address = "$A$2" Then
Select Case Sheets("Input").Range("A2")
Case "Hide3"
Range("A11:A13").EntireRow.Hidden = True
Case "Hide4"
Range("A15:A17").EntireRow.Hidden = True
End Select
End If
Currently, I face the problem that when I change A1 to Hide1, Row 3-5 will hide but unhide immediately when I change A2 to Hide 3 while Row 11-13 gets hidden only.
How do I make sure that after changing A1, Row 3-5 continue to be hidden even after I change A2? E.g. I change A1 to "Hide 1", Rows 3-5 gets hidden. Next, I change A2 to "Hide 3", I want Rows 11-13 gets hidden while Rows 3-5 continues to get hidden.
Last edited by a moderator: