I have a simple code to hide and unhide sheets based on a drop down. the code keeps my "control" sheet visible at all times. i need to have other tabs visible as well. for example i want to have the "test" tab visible at all times. can someone please explain how can i add these additional tab exceptions to the code? I thought it was a simple Or statement but that is not working. Thanks.
Here is the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim ws As Worksheet
Set rng = Target.Parent.Range("office")
If Target.Count > 1 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then Exit Sub
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "control" Then ws.Visible = xlSheetHidden
Next ws
Sheets(Target.Value).Visible = True
End Sub
Here is the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim ws As Worksheet
Set rng = Target.Parent.Range("office")
If Target.Count > 1 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then Exit Sub
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "control" Then ws.Visible = xlSheetHidden
Next ws
Sheets(Target.Value).Visible = True
End Sub