Nanogirl21
Active Member
- Joined
- Nov 19, 2013
- Messages
- 330
- Office Version
- 365
- Platform
- Windows
Hi,
I am hoping someone could help.
I am using the below VBA code to unhide/hide a sheet based on a single cell value of "Yes" or "No". How can I adjust my code to include a range?
Example: If “Yes” is in any cells A1, A2, or A3 (A1:A3) unhide “FINAL” worksheet. If “No” or if a cell is BLANK in any cells within the range then hide worksheet called “FINAL”.
I tired using the code below, but it does not work if A2 or A3 is No. The sheet "FINAL" should still show because A1 is "Yes".
I am hoping someone could help.
I am using the below VBA code to unhide/hide a sheet based on a single cell value of "Yes" or "No". How can I adjust my code to include a range?
Example: If “Yes” is in any cells A1, A2, or A3 (A1:A3) unhide “FINAL” worksheet. If “No” or if a cell is BLANK in any cells within the range then hide worksheet called “FINAL”.
VBA Code:
If [A1] = "Yes" Then
Sheets("FINAL").Visible = True
Else
Sheets("FINAL").Visible = False
End If
End Sub
I tired using the code below, but it does not work if A2 or A3 is No. The sheet "FINAL" should still show because A1 is "Yes".
VBA Code:
If [A1] = "Yes" Then
Sheets("FINAL").Visible = True
Else
Sheets("FINAL").Visible = False
End If
If [A2] = "Yes" Then
Sheets("FINAL").Visible = True
Else
Sheets("FINAL").Visible = False
End If
If [A3] = "Yes" Then
Sheets("FINAL").Visible = True
Else
Sheets("FINAL").Visible = False
End If
End Sub