Dear all,
I have a spreadsheet in which I need several rows to become hidden, dependent on the value in cell L3 (which is chosen from a drop-down list).
I've been searching here and found several topics on worksheet change events, which helped me to get to the following:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("L3")) Is Nothing Then
Select Case Target.Value
Case Is = "PP16", "NGM", "ESX", "ESI", "ESS", "YF"
Range("24:29,46:51,68:73,90:95, ... etc ").Select
Selection.EntireRow.Hidden = True
Case Is = "PP21"
Range("8:800").Select
Selection.EntireRow.Hidden = False
Range("29:29,51:51,73:73,95:95, ... etc").Select
Selection.EntireRow.Hidden = True
Case Is = "PY23", "-"
Range("8:800").Select
Selection.EntireRow.Hidden = False
End Select
End If
Range("A8").Select
End Sub
note:in the original code I have in my worksheet, "...etc" is a list running up to row 711. But I didn't want to 'bore' you with he whole list.
This does what I need it to do with one small 'bug': it fires every time any cell in the worksheet is adjusted and I need it to fire only if cell L3 is adjusted.
Haven't been able yet to figure out how to do that
, so....any suggestions are very welcome.
Thanks in advance.
Thirsa
Bookmarks