Sub Hide_It()
If Sheets(1).Range("a1") = "Change this string" Then
Sheets(2).Visible = False
Else
Sheets(2).Visible = True
End If
End Sub
Sub Hide_It()
Sheets(2).Visible = (Sheets(1).Range("a1") <> "Change this string")
End Sub
Code:Sub Hide_It() If Sheets(1).Range("a1") = "Change this string" Then Sheets(2).Visible = False Else Sheets(2).Visible = True End If End Sub
Change that string to what ever value you want.
This one is actually shorter
Code:Sub Hide_It() Sheets(2).Visible = (Sheets(1).Range("a1") <> "Change this string") End Sub
that code means that if a1 on your first sheet (name doesn't matter, only position) says "Change this string", that it will show or hide the 2nd sheet (again, name doesn't matter)
you know that you have to run that code, right? it doesn't just work. well, unless you put it in a SheetChange event in your sheet1 module.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents= False
Sheets(2).Visible = (Sheets(1).Range("a1") <> "Change this string")
Application.EnableEvents= True
End Sub
in the vba editor, open up the sheet1 module, and put this in it
Code:Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents= False Sheets(2).Visible = (Sheets(1).Range("a1") <> "Change this string") Application.EnableEvents= True End Sub
Before you tell me it doesn't work, tell me what you have on sheet 1 A1. What do you want to hide the sheets with?
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Sheets(2).Visible = (Sheets(1).Range("a1").Value = True)
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Sheets("EXIT").Visible = (Sheets("ENTER").Range("a1").Value = True)
Application.EnableEvents = True
End Sub