Password/Multiple Sheets

  • Thread starter Thread starter Glenn
  • Start date Start date
G

Glenn

I would like a macro that when pushed it will display a
message "please insert password" if the password entered
is correct then it will goto sheet2 if the password is
incorrect it will display a message "Incorrect Password"
and go to sheet1

thanks
 
Glenn,

Copy/Paste this code into a regular module:

Sub Pwd()
Dim passwd As String
passwd = InputBox("Please enter password: ", "Password Input")
If passwd = "xyz" Then
Sheets(2).Visible = True
Sheets(2).Activate
Else
MsgBox "Wrong Password"
Sheets(1).Activate
End If
End Sub

And then create a button from the "Forms" toolbar and when
prompted, assign it to this macro.

John
 
Back
Top