Protecting Workbook and its Contents

Gilliam

Active Member
Joined
Jul 10, 2014
Messages
286
Hello, I am continually running into an issue when trying to protect my workbook with macro's

I have a workbook with 12 sheets.
Upon workbook_open, I hide them all, except the first which is protected completely, no one can even click on a cell. At the end of the code, I protect the workbook with a password, lets call it "hello". protecting the workbook will restrict the user from running a macro to unhide the other (unprotected) worksheets.

*Sure, I could protect every sheet with a macro, but I am going to be using each of those 12 sheets on a daily basis and don't want to have to enter a password to unprotect the sheet 12 times. I want to go around this, by letting the user put in a password once, unprotect the workbook, unhide all the worksheets, and unprotect the first one.*

**The workbook is just a template**

When I add the code to unprotect the workbook at the start of workbook_Open, and re-open the workbook, macros have been disabled, and there is no way to re-enable them.

Essentially, I have 2 questions:
1. Is it possible to enter a password for the workbook before Excel even opens up?

OR,

2. how do I go about protecting my workbook so that nobody can see the 11 other worksheets, and protect my code (I have to protect the code because the password is in there).

Cheers,
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I understand the Files accessible at work can be locked before excel opens, however I believe that is a function of IT so i'm not too sure if this can be done.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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