Password Issue

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
771
Office Version
  1. 365
Platform
  1. Windows
Good Evening,

I have been supplied some code that hides a password if a tick box is ticked.

Is there anyway the code below can be chnaged so the tick box isnt an issue and the password is just "******" out.

The code i am using is as below.

chkHide is the part on the userform says "Hide Password"

Code:
txtPass.PasswordChar = IIf(chkHide.Value, "*", "")

Many Thanks
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Many Thanks, that worked.

I hope you dont mind but is there a chance you can answer this password issue please.

I have 8 spreadsheets in a workbook that i need to protect.
The issue i have is that I need to be able to run a userform that puls info out of one and saves into 3 of them. the other 3 are all stat related.

Is there anyway i can lock say all of them so that people cant delete info , but the userform can still enter information.
As well as allowing a 3 managers to open the other 3 if a userform is entered??

Many thanks
Gavin
 
Upvote 0
To protect and allow your code to make unrestricted changes to a sheet you can use the UserInterfaceOnly property:

<font face=Calibri><SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Const</SPAN> pword <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN> = "bigdog"<br><br><SPAN style="color:#00007F">Sub</SPAN> foo()<br>    <SPAN style="color:#00007F">Dim</SPAN> ws <SPAN style="color:#00007F">As</SPAN> Worksheet<br>        <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> ws <SPAN style="color:#00007F">In</SPAN> ActiveWorkbook.Worksheets<br>            ws.Protect pword, UserInterfaceOnly:=<SPAN style="color:#00007F">True</SPAN><br>        <SPAN style="color:#00007F">Next</SPAN> ws<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>

I'm not too sure about the last part. If you want to give people conditional editing ability, then you can give them the password.
 
Upvote 0
Cheers

I take it i would put this VB in the worbook.

Will this stop anything be saved to it or just amending the spreadsheet.

Gavin
 
Upvote 0
Yes, you'd open the VB Editor (ALT+F11), then insert a module and paste the code in there. You can assign it to a button, call it from the Workbook_Open event, or choose it from the macro list.

This won't stop anyone from saving the workbook, but it will prevent them from making any entries other than from the user form.
 
Upvote 0
Good Afternoon Smitty,

Sorry about the message out of the Blue but i need to ask you something concerning a password issue you have previosly helped me with.

You showed me how to create a password box that allows a name & password to be entered. If they are correct it loads a userform.

I want to use the same password form but instead of opening a userform i need it to unhide 2/3 sheets. The sheets that are unlocked would depend on the password entered. Is there any chance you can point me in the right direction.

Code:
If Worksheets("Info").Range("I" & cmbMgrs.ListIndex + 2) = txtPass Then ' Start of 1st If Block
        MsgBox "Correct password entered, please wait while open Car Parks are Checked", vbInformation
        
        Unload Me
    
    Application.ScreenUpdating = False

I am having trouble getting the password = "PW" unhide else "PW" unhide etc...

Many Thanks
 
Upvote 0

Forum statistics

Threads
1,224,593
Messages
6,179,791
Members
452,942
Latest member
VijayNewtoExcel

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