Protect different sheets with different passwords...


Posted by KoMeNg on January 23, 2001 6:12 AM

Hi,

Let say I have 5 sheets in my workbook.(a,b,c,d,e)
What I like to do is..everytime the workbook
opened.it will always go to sheet a..when user try to click
sheet b (or c,d or e) , a prompt box will appear
and asked for the sheet password. If the user can't give
the right password, they will remain in sheet a.
Is it possible, thanks in advance

Posted by Dave Hawley on January 23, 2001 6:36 AM

Hi KoMeNg


Right click each sheet name tab, select "View Code" and paste in this code. Just change the Case Sensitive password "Secret".


Private Sub Worksheet_Activate()
Dim Reply As String
Reply = InputBox("Please supply the password for " & Me.Name, "Security")
If Reply <> "Secret" Then
Me.Previous.Select
End If
End Sub


Hope this helps

OzGrid Business Applications

Posted by Dave Hawley on January 23, 2001 6:41 AM


Oops forgot the sheet a on open bit.

Right click on the sheet picture top left, next to "File" select "View code" and paste in this:

Private Sub Workbook_Open()
Sheet1.Select
End Sub

OzGrid Business Applications



Posted by Komeng on January 23, 2001 9:16 AM

Thanks a dozen Dave. Dave, you are awesome man.
Bye and regards