Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasword and Hiding a Worksheet

Status
Not open for further replies.

crystal0streaks

Technical User
May 11, 2006
39
US
I am sending a Excel book to some clients and was wondering if it is possible to password protect a hidden worksheet. I would like to have 4 worksheets available, but only one visible. I will give specific clients passwords to open one of the three hidden worksheets. How can this be setup? I know how to protect the entire book, and how to make sure there is no edits on the original. But I would prefer the clients didn't know that there are three worksheets.

Can anyone help?

-crys
 
YOu can do this BUT, there is no foolproof way to ensure that each client cannot see the dat of the others, and I would think you may well be in danger of breaching some Data Protection rules if you were to do so. No matter what you sent me I could get to any hidden worksheets, password protected or not, and if I thought that my data had gone out to others in that fashion, I would go nuts.

If you still chose to go that way then you8 need to set up a dummy sheet in there that gives away nothing, then set every other sheet to xlVeryHidden, and use code to display the relevant worksheet when the password is entered. I would also then have code set it to xlVeryHidden again when it is closed using the BeforeClose event.

Personally though I would never do this with different clients data.

Regards
Ken.............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Absolutely agree with Ken on this.

If you have different clients, I would strongly advise that they get a seperate workbook each

Worksheet level protection can be broken via VBA. WorkBOOK protection is a little harder but there are techniques for releasing the data and if all else fails, the password can be cracked by brute force

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
I probably should have specified, the worksheets don't have my clients information on them. They are price lists. I have three different type of clients, and they all have different price lists.

-crys
 
in which case I would definitely not do this. Can you imagine how p***ed off your client would be if they found out that they were paying more for the same service !!!!

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
One possible starting point (this needs more work to be anything approaching secure) is using VBA to request a password when the workbook is opened. This assume a 4 sheet book with default names.

Code:
Private Sub Workbook_Open()
Dim sResp As String
[Sheet2].Visible = xlSheetVeryHidden
[Sheet3].Visible = xlSheetVeryHidden
[Sheet4].Visible = xlSheetVeryHidden
sResp = InputBox("Input the Password to enable the worksheet", "Password", "password")
Select Case LCase(sResp)
    Case Is = "pwd1"
        [Sheet2].Visible = xlSheetVisible
    Case Is = "pwd2"
        [Sheet3].Visible = xlSheetVisible
    Case Is = "pwd3"
        [Sheet4].Visible = xlSheetVisible
    Case Else
        MsgBox "You have not entered a password"
End Select
End Sub

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
This is why I am trying to password and hide the sheets. But if this is not possible or will create more problems than it's worth, ok. thanks.

-crys
 
...which is, apparently, what Ken had already suggested!!!

As for the ethical/legal issues - the ball's in your court!

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Thanks for the help and advise. I will take it all into consideration. Thanks again.

-crys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top