Hey guys,
I'm trying to run a Case statement that will check the value of a cell that contains a drop down box, and then either hide or unhide a specific row based on the result. I'm having all-sorts of trouble with it, and I'm sure it's pretty straight forward!
H7:H16 is a range that contains a drop-down box where users select a string value representing a volumetric size.
Private Sub Worksheet_Change(ByVal Target As Range)
If Application.Intersect(Target, Range("H7:H16")) Is Nothing Then
Exit Sub
End If
If Target.Cells.Count > 1 Then
Exit Sub
End If
If Target.Value = "" Then
Exit Sub
End If
Application.EnableEvents = False
With Target
If .HasFormula = False Then
Select Case Range("H7:H16").Text
Case "600mL"
ActiveSheet.Rows("21:21").Hidden = True
Case "2000mL"
ActiveSheet.Rows("21:21").Hidden = False
End Select
End If
End With
Application.EnableEvents = True
End Sub
I'm not even sure I'm supposed to put it in the Worksheet_Change Sub, or if half the lines of code I've got in there are even relevant. I ripped the code from another Case statement that actually works, but which relied on data entry to the cell, not drop-down boxes.
I'm sure I've made a complete hash of it! Sorry for the mess.....
Bookmarks