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,
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Gilliam

Active Member
Joined
Jul 10, 2014
Messages
286
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,102,753
Messages
5,488,642
Members
407,650
Latest member
polonic

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top