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
 

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

Back
Top