Hide sheets using vba

P

PJ

Hi all

I have a sheet initally hidden(Contact) and the rest visiable, what I am
trying to do is when today() = 1-11-06 it automatically unhides the Contact
sheet and hides all the rest.

I am trying to do it with having a button assigned to a macro - Having no
luck...

Any help welcome.

Thanks
Paul

tried...
Sheets("Menu").Range ("A1") >= "01/11/2006"
GoTo hide
Sub hide()
Run
Sheets(Array("Health Dec", "Menu", "UK", "EU", "XU", "WW", "AT EU", "AT
WW", "Summary") _
).Select
Sheets("Health Dec").Activate
ActiveWindow.SelectedSheets.Visible = False
Sheets("Contact").Visible = True
Sheets("Long stay").Select
ActiveWindow.SelectedSheets.Visible = False
End Sub
 
P

PJ

Sussed it...with

Private Sub Workbook_Open()
If Sheets("Menu").Range("A1") >= "01/11/2006" Then
Sheets(Array("Health Dec", "Menu", "UK", "EU", "XU", "WW", "AT EU", "AT
WW", "Summary") _
).Select
Sheets("Health Dec").Activate
ActiveWindow.SelectedSheets.Visible = False
Sheets("Contact").Visible = True
Sheets("Long stay").Select
ActiveWindow.SelectedSheets.Visible = False
End If
End Sub
 
Ó

Óã¸É

Sub yqr()
For Each aaa In ActiveWorkbook.Worksheets
If aaa.Name <> "Contact" Then aaa.Visible = False
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top