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:
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

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:
 

Watch MrExcel Video

Forum statistics

Threads
1,118,456
Messages
5,572,241
Members
412,450
Latest member
Heba
Top