Hello All! I was attempting to have a tab hidden based upon 'yes' or 'no' value placed into the cell of another tab. I have included my macro below (see very end for my issue) which is not working. Any recommendations appreciated! Thanks!
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
'Participant Update to Cell C8
'The formula directly below allows us to change between the different cells that the participants will be updating as we move through the macro
If Target.Address(0, 0) = "C8" Then
'Message Box Appears and Unhides Rows if Value is less than 25
If Target < 25 And Target <> "" Then
Rows("10:11").EntireRow.Hidden = False
MsgBox "Unless the plan has less than 250 participants, it would be unusual to have a sample size of less than 25. Verify that this is the sample size that was determined to be appropriate."
'Hides Rows if Value is equal to or greater than 25
ElseIf Target >= 25 Or Target = "" Then
Rows("10:11").EntireRow.Hidden = True
End If
'Iteration of End Function Req'd for all embedded If-Then Statements in the macro'
'Participant Update to Cell C12
ElseIf Target.Address(0, 0) = "C12" Then
'Hides Rows if Cell C12 equals "No"
If Target = "YES" Then
Rows("13:15").EntireRow.Hidden = False
ElseIf Target = "NO" Then
Rows("13:15").EntireRow.Hidden = True
End If
'Why Don't you give Task 1C and Task 1D a shot!
'Participant Update to Cell C24
ElseIf Target.Address(0, 0) = "C24" Then
'Unhides rows and unhides column in Tab 2 if C24 says "Yes"
If Target = "YES" Then
Rows("25").EntireRow.Hidden = False
Rows("26").EntireRow.Hidden = False
'Note that format below to reference cells/rows/columns in other worksheets
'I found it best to copy and paste the tab name directly from the tab because sometimes just typing it doesn't work.
With Worksheets("2) Participant Eligibility")
.Columns("F:F").EntireColumn.Hidden = False
End With
'End With Function required when we are manipulating items on different excel worksheets
End If
If Target = "NO" Then
Rows("25").EntireRow.Hidden = True
Rows("26").EntireRow.Hidden = True
With Worksheets("2) Participant Eligibility")
.Columns("F:F").EntireColumn.Hidden = True
End With
End If
'Participant Update to Cell C67
'Shows Tab 6 if Cell C67 is "Yes" Otherwise Tab remains hidden
Select Case Worksheets("1) Scoping").Range("C67").Value
Case "YES"
Worksheets("6) Safe Harbor & Profit Sharing").Visible = True
Case " "
Worksheets("6) Safe Harbor & Profit Sharing").Visible = False
Case "NO"
Worksheets("6) Safe Harbor & Profit Sharing").Visible = False
End Select
End If
End Sub