View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
MDAddio MDAddio is offline
external usenet poster
 
Posts: 2
Default Password Protect Unhide Worksheet?

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