View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Protect or Hide all worksheets in a workbook except 1

Hi,

First the ususal cautionary note, this isn't secure, Excel protection is
designed to protect against accidental deletions etc and not to provide high
levels of security.

One way.

Alt+F11 to open VB editor and double click 'ThisWorkbook' and paste this in
on the right

Private Sub Workbook_BeforeClose(Cancel As Boolean)
For x = 2 To Worksheets.Count
Sheets(x).Visible = xlVeryHidden
Next
End Sub

Then right click 'Thisworkbook' and insert module and paste this in. Put a
button on the one remaining visible sheet that calls this code. The visible
sheet will be the leftmost sheet irrespective of name. Change Mypass to your
password

Sub View_Sheets()
response = InputBox("Enter password", "Password")
If response < "Mypass" Then Exit Sub
For x = 2 To Worksheets.Count
Sheets(x).Visible = True
Next
End Sub

Mike

"Gator Girl" wrote:

I have a workbook with 61 worksheets, 60 of which I do not want to be seen or
used without use of a password. I want a single password to open up all 60
hidden worksheets to view and to edit.

The worksheets each have a different employees name. So I need to know if
I have to write the code to the specific sheet names, or if it will work with
€śSheet1€ť etc no matter what the sheets name is.

I ask this because employees come and go and once I have the successful
code I need to know if I have to edit it each time we gain or lose an
employee.

I have dutifully read all possible applicable info I could find, and tried a
couple of solutions but no luck.