ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password/Multiple Sheets (https://www.excelbanter.com/excel-programming/289411-password-multiple-sheets.html)

Glenn

Password/Multiple Sheets
 
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

John Wilson

Password/Multiple Sheets
 
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

"Glenn" wrote in message
...
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





All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com