Adding a password for the sheet using Macro not distorting the buttons

wedzmer

New Member
Joined
Mar 15, 2015
Messages
24
I am trying to lock my worksheets using the old fashioned way: RIGHT CLICK > PROTECT SHEET... > PASSWORD

but when I try to use the Hide and Reset buttons of my worksheet, the PASSWORD UNLOCKER pops-up which I don't wish to happen.

I'm locking the codes so that the users will not be able to accidentally distort it and also those who wish to copy it would be unable to do so..

Here's the excel file i'm working on...

http://www.filedropper.com/ecr1

Sorry I don't know how to attach files here. :(
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Maybe because Hide/Reset will modify the cells that already protected?
Me, use another macro to un-protect sheets before it run the button and then protect it again.
 
Upvote 0
Maybe because Hide/Reset will modify the cells that already protected?
Me, use another macro to un-protect sheets before it run the button and then protect it again.

Im really not a macro user.. All of these codes are mere compilation from codes i got from the internet.
p,ease help
 
Upvote 0
Hi wedzmer

Try the following:

Review tab, Protect Sheet, uncheck Select Locked Cells. Put in password if you desire. Do the same for all required sheets.

Optional: Protecting VBA Project

Alt+F11, Tools Tab, VBA Project Properties, Protection Tab, check 'lock project for viewing', put password in.



 
Upvote 0
Hi wedzmer

Try the following:

Review tab, Protect Sheet, uncheck Select Locked Cells. Put in password if you desire. Do the same for all required sheets.

Optional: Protecting VBA Project

Alt+F11, Tools Tab, VBA Project Properties, Protection Tab, check 'lock project for viewing', put password in.


EDIT:

You can actually do it your way, even without unchecking Selecting Locked Cells. Just leave the password field blank and it should work. I guess it depends whether you need to actually put a password on it.

If it's just a preventative measure (user cant modify the sheet) for people who will use your worksheet without malicious intent then maybe you don't need it?
 
Upvote 0
EDIT:

You can actually do it your way, even without unchecking Selecting Locked Cells. Just leave the password field blank and it should work. I guess it depends whether you need to actually put a password on it.

If it's just a preventative measure (user cant modify the sheet) for people who will use your worksheet without malicious intent then maybe you don't need it?

The hide and reset buttons automatically protects the worksheet, however, the user can easily unprotect it by going the unlocking procedure the old fashion way since there is no password for it. And when i put a password on it, the macro functions for the hide and reset buttons won't work any kre since the user needs to have access on my password.

i wanted to put a password on it whilst the macros would still be working even though they don't know my password and it would only require to do so if they try to unprotect the sheet manually (something like that).
 
Upvote 0
The hide and reset buttons automatically protects the worksheet, however, the user can easily unprotect it by going the unlocking procedure the old fashion way since there is no password for it. And when i put a password on it, the macro functions for the hide and reset buttons won't work any kre since the user needs to have access on my password.

i wanted to put a password on it whilst the macros would still be working even though they don't know my password and it would only require to do so if they try to unprotect the sheet manually (something like that).

Hi wedzmer

What kind of users are going to be using your workbook?
I realise that the user can unprotect the sheet by clicking unprotect if theres no password but the point I was trying to make is that there may not be a need for a hard coded password if you're just trying to stop them from accidental formatting or clicking where they shouldn't be clicking. If they're going to go beyond that and purposely try to unprotect the sheet and modify it in some way for some reasons, my hunch is that not even a hard coded password is going to stop them since they can strip it away with other software and open the book regardless.

You wrote:
I'm locking the codes so that the users will not be able to accidentally distort it and also those who wish to copy it would be unable to do so..

If you protect the sheet without the password AND password protect the VBA project, then if the user does unprotect the sheet from the review tab and then tries to Edit your VB code (by right clicking on your button and selecting Assign Macro, or by simply going to VB Editor) they will need a hard coded password. That alone might deter the user from looking inside your workbook. You can't completely protect the workbooks from intruders though I don't think.



 
Upvote 0
Hi wedzmer

What kind of users are going to be using your workbook?
I realise that the user can unprotect the sheet by clicking unprotect if theres no password but the point I was trying to make is that there may not be a need for a hard coded password if you're just trying to stop them from accidental formatting or clicking where they shouldn't be clicking. If they're going to go beyond that and purposely try to unprotect the sheet and modify it in some way for some reasons, my hunch is that not even a hard coded password is going to stop them since they can strip it away with other software and open the book regardless.

Well, I'm hoping that if they would really like to read on the codes then at least they would sort to going on softwares just to unlock them.. ^_^

Many of the users who'd use the file might use it for their own benefit, like claim the output project... That's what I'm really preventing.
 
Upvote 0

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

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