PASSWORD

Rob33

New Member
Joined
Jun 20, 2003
Messages
33
I am trying to get a Userform to have a password so that it allows a person (who types in the correct password) to go to another sheet in a workbook??

I have hidden the sheet tabs thhrough "tools" - "Options" - just so people can't see all the sheet tabs!


Can anyone help!!! :confused: :confused: :confused:
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Simple, and to the point. I think you can format the inputbox as a password field, but I can't recall how.

Now just protect your code and you are all set.



Code:
Private Sub TextBox1_Change()
Password
End Sub


Sub Password()
If TextBox1.Value = "Password" Then
Sheet1.Visible = xlSheetHidden
Sheet2.Visible = xlSheetVisible
Else
Sheet1.Visible = xlSheetHidden
Sheet2.Visible = xlSheetHidden
End If
End Sub
 
Upvote 0
password

:biggrin: :biggrin: :biggrin: - is it possible to go to sheet2 after the "enter" key is pressed - with the below code, as soon as "password" is typed the userform still remains - i was hoping to be able to press "enter" and the userfrom disappears and the person is either in sheet1 (incorrect password) or sheet2 (correct password) :cool: :cool:

Private Sub TextBox1_Change()
Password
End Sub


Sub Password()
If TextBox1.Value = "password" Then
Sheet2.Select
Else
Sheet1.Select
End If
End Sub
 
Upvote 0
You might also try setting the PasswordChar Property of the TextBox to, for example, "*".

Hope that helps!
 
Upvote 0
Got the - PasswordChar Property - thanks Tazguy37

where in the code do i add:

UserForm1.Visible = xlSheetHidden

to make it work????? :confused:
 
Upvote 0
Just remember this particular type of "security" is really really easy to break. :wink:
 
Upvote 0
You might try:

Code:
Sub Password()
    If TextBox1.Value = "password" Then
        Unload UserForm1
        Sheet2.Activate
    Else
        Sheet1.Activate
    End If
End Sub

Oorang said:
Just remember this particular type of "security" is really really easy to break.

Yup. Either protect your protect your VBA Project or put the code in an add-in.
 
Upvote 0
Password

:LOL: :LOL: :LOL: :LOL: :LOL:

Works a treat!!!

I have protected the VBA Project - most users won't know how to access it anyway (Users are not very good at Excel - which i why i needed to Password some sheets - becuse it is the people who don't know what thay are doing that seem to do the most damage to my spreadsheets!!!)



THANKS AGAIN

ROB!! :LOL:
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top