I have a selection change on worksheet "Attendance".
Cell B2 is a Data Validation drop down with 3 options (one of which is "Non-Functional Prototype").
When the drop down is changed, I want to perform a series of actions on all the other sheets in my workbook (i.e. mostly hide or unhide rows to show appropriate info)
The code is below.
Code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$2" Then
If Worksheets("Attendance").Range("B2").Value = "Non-Functional Prototype" Then
'Predecessors
Worksheets("Predecessors").Rows("6:14").Hidden = False
Worksheets("Predecessors").Rows("15:25").Hidden = True
Worksheets("Predecessors").Rows("26:42").Hidden = True
Worksheets("Predecessors").Rows("43:59").Hidden = True
Worksheets("Attendance").Range("h20").Value = "if works"
End If
End If
Worksheets("Attendance").Range("h18").Value = "Hello"
End Sub
Display More
I put in two little tests to make sure it was going to the correct lines. The "Hello" appears, but not the "if works". The rows in the IF statement are not hidden/unhidden as required.
What am I not doing properly? I am sure it is something silly and I have simply not had enough coffee yet.
Thanks