Password userform activate

  • Thread starter Thread starter Moh
  • Start date Start date
M

Moh

anyone please can you tell me how to use the userform4 with the password

i've created a userform called userform4

i have a label1 "password"

textbox1 for the user to type the password in

Commandbutton1 is OK - if password (7496) is correct then take me to
Banking Sheet
- if wrong password then message box says Sorry please re-enter the correct
password.

Commandbutton2 is Cancel - this should return to main menu


just please show me how this works

Thank you
 
Hi Moh

try this
'---------------------------------------
Private Sub CommandButton1_Click()
If Me.TextBox1.Value = 7496 Then
Worksheets("Banking Sheet").Activate
Else
MsgBox "Wrong Password"
Me.TextBox1 = ""
End If
End Sub
'---------------------------------------
Private Sub CommandButton2_Click()
Unload Me
End Sub
'---------------------------------------

hope that helps

Carlo
 
carlo that worked many thanks 1 last thing please.....

say if i create a new worksheet (called users)
column A is list of users
column B is list of passwords

Again using Userform4
textbox1 is for username
textbox2 is for passwords

commandbutton1 is for OK - takes me to the banking sheet if correct username
and password

commandbutton2 is for Cancel - takes me to the main menu worksheet.

can you write out a code for this pls
 
Back
Top