Good Day,
I am helping acolleague of mine with some VBA code I am rather inexperienced with. She has aData Validation drop down list to select from. When a user makes a selectionfrom drop down, it hides and unhides specific rows based on what the colleaguewants the user to see. The code works as expected but the problem lies withblanks. If a user pushes the delete key when they click on the cell with the drop-downbox, the code goes into debug mode. I’ve tried a great any ways to end the subif that happens but all unsuccessfully. Please let me know if you have anythoughts. I can’t figure out how to get another if statement inside the Casestatement (that was my thought).
Thanks so much in advance,
Matt
Option Explicit
Private Sub Drop_Down(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("D44"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "": Rows("47:92").EntireRow.Hidden = False
Case Is = "Condition One": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False
Case Is = "Condition Two": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False
Case Is = "Condition Three": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False
End Select
End If
End Sub
I am helping acolleague of mine with some VBA code I am rather inexperienced with. She has aData Validation drop down list to select from. When a user makes a selectionfrom drop down, it hides and unhides specific rows based on what the colleaguewants the user to see. The code works as expected but the problem lies withblanks. If a user pushes the delete key when they click on the cell with the drop-downbox, the code goes into debug mode. I’ve tried a great any ways to end the subif that happens but all unsuccessfully. Please let me know if you have anythoughts. I can’t figure out how to get another if statement inside the Casestatement (that was my thought).
Thanks so much in advance,
Matt
Option Explicit
Private Sub Drop_Down(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("D44"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "": Rows("47:92").EntireRow.Hidden = False
Case Is = "Condition One": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False
Case Is = "Condition Two": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False
Case Is = "Condition Three": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False
End Select
End If
End Sub
Last edited by a moderator: