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

slight modification to mikes code:

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

mysheet = "Sheet1"

If Sh.Name = mysheet Then
Application.EnableEvents = False

Sh.Visible = False

response = InputBox("Enter password to view sheet")

If response = "MyPass" Then

With Sheets(mysheet)
.Visible = True
.Select
End With

Else

Sheets(mysheet).Visible = False

End If
End If

Application.EnableEvents = True

End Sub
--
jb


"garyh" wrote:

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