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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

crobertson

New Member
Joined
Nov 14, 2005
Messages
32
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
 

Rob33

New Member
Joined
Jun 20, 2003
Messages
33
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
 

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237

ADVERTISEMENT

You might also try setting the PasswordChar Property of the TextBox to, for example, "*".

Hope that helps!
 

Rob33

New Member
Joined
Jun 20, 2003
Messages
33
Got the - PasswordChar Property - thanks Tazguy37

where in the code do i add:

UserForm1.Visible = xlSheetHidden

to make it work????? :confused:
 

Oorang

Well-known Member
Joined
Mar 4, 2005
Messages
2,071

ADVERTISEMENT

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

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
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.
 

Rob33

New Member
Joined
Jun 20, 2003
Messages
33
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:
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,004
Messages
5,834,833
Members
430,324
Latest member
bosphoruskid

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
Top