bluefish44
Board Regular
- Joined
- Apr 3, 2009
- Messages
- 190
Hi all, I need a simple piece of code to run when a data validation list is changed in cell E2. I have right clicked the correct tab and added this code below, and selected Worksheet and Change from the 2 dropdown boxes. It seems like I am doing this correctly from other posts on the subject, but when I enter the dropdown list in cell E2 and make a change, the code doesn't run. I am using excel 2010. Thanks in advance for any suggestions (my VBA skills are a bit shaky, but my code runs fine when I run it as a separate macro - just the worksheet change Event doesnt seem to work)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$e$2" Then
Rows("6:50").Select
Selection.EntireRow.Hidden = False
Dim i As Integer
For i = 6 To 50
Rows(i).Hidden = Range("aj" & i).Value = 0
Next i
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$e$2" Then
Rows("6:50").Select
Selection.EntireRow.Hidden = False
Dim i As Integer
For i = 6 To 50
Rows(i).Hidden = Range("aj" & i).Value = 0
Next i
End If
End Sub