Tab password to view

J

jackrobyn1

Hi
I am trying to put a password onto a tab so that when i select it, i cant
see it until i enter a password. There is a solution that i have found on
this group but for some reason cant get it to work for me. When i click my
worksheet (Data) it asks for a password..... so far so good, but when i enter
the password it doesnt show me the (data) sheet, just selects another one! Im
not sure where im going wrong. My work sheets are named "Data" "Printable
graphs 1" and "Printable graphs 2" if this helps.... i would like my password
to be "xxx" Thanks in advance.
This is what i tried to adapt and use

Private Const Password As String = "DoubleOhSeven"

Private Sub Worksheet_Activate()
Me.Visible = False
If InputBox("Please Enter the Password for the " _
& Me.Name & " Sheet", "Enter Password") _
<> Password Then
Me.Visible = False
Else
Me.Visible = True
End If
End Sub
 
M

Mike H

Try this

Private Const Password As String = "DoubleOhSeven"

Private Sub Worksheet_Activate()
Application.EnableEvents = False
Me.Visible = False
If InputBox("Please Enter the Password for the " _
& Me.Name & " Sheet", "Enter Password") <> Password Then
Me.Visible = True
Else
Me.Visible = True
Me.Select
End If
Application.EnableEvents = True
End Sub


Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top