View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
pikus pikus is offline
external usenet poster
 
Posts: 1
Default How can I test when any worksheet within a workbook is selected

Here’s what I’m thinking:

You could use something like this:
Private Sub Workbook_Open()
pwd = InputBox("Please enter password.")
If pwd = "secret" Then
Worksheets(2).Visible = -1
Else
Worksheets(2).Visible = 2
End If
End Sub

Which will ask for a password when the file is opened and based on tha
password you could have a series of ElseIf statements asking for th
various passwords. Setting .Visible = 2 makes the Sheet “Very Hidden
and no one will be able to tell it’s even there and setting it to –
makes it visible. You could then go to Tools-VBAProject Properties i
the VBA Editor and lock the project for viewing and protect that with
password.
I’m sure you could create your own form with a password field tha
masks input, but the rest of this could be perfect for what you want

--
Message posted from http://www.ExcelForum.com