View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
[email protected] jarrod.heglund@gmail.com is offline
external usenet poster
 
Posts: 2
Default Password Protect Unhide Worksheet?

On Thursday, September 27, 2012 2:27:59 AM UTC+8, MDAddio wrote:
On Monday, March 23, 2009 8:28:44 AM UTC-4, Harald Staff wrote:

Protect the Workbook, not the Worksheet.




HTH. Best wishes Harald




"garyh" wrote in message


...


Is there a way to password protect a worksheet so that the user cannot


UNHIDE


the worksheet unless she/he knows the password?




Thanks, in advance, for your help.




G




the below works pretty good for me



Private Sub Worksheet_Activate()

Dim PASSWORD

LINE1:

PASSWORD = Application.InputBox("Please enter the password word", "Password")

If PASSWORD < "PASSWORD1" Then

MsgBox "Please Supply a valid password", vbCritical

GoTo LINE1

Else

ActiveSheet.Unprotect PASSWORD

End If

End Sub


That does work, but the person can still see the data on the worksheet without having the password. Also, if they don't have the password, there is no way for them to cancel the popup box. You'd be onto a winner if those two bits were added. I'd use it.