Locking a Worksheet Automatically

by Allen Wyatt
(last updated February 19, 2019)


Andries has a shared workbook on a network and it works great. It allows multiple teachers at his school to make changes in the various worksheets, within limits he specifies through cell and worksheet protection. The shared workbook also allows him to track changes so he can see what happens to the data in the worksheets. Andries would like a way, though, to automatically "lock" a worksheet after a given date so it can no longer be changed. If he attempts to do it manually, he loses all of the tracked changes, which is unacceptable. He wonders if there is a way to lock a worksheet automatically, by date, and not lose the tracked changes.

There is no way to do this in Excel. The problem is just as you mentioned—when you unshared the workbook (which must be done to make the desired changes to it—you lose the tracked changes. This, for whatever reason, is designed into Excel. In fact, there are a number of features that are made unavailable whenever you share a workbook. The following page at the Microsoft site, even though it says it is for Excel 2003, is also applicable to later versions:


There is one possible way around this if you want to protect the entire workbook: You could simply change the workbook itself so it is read-only. This would have to be done outside of Excel, simply because you cannot do it on a workbook that is currently open. It could, however, be done using a batch file, which means you could set up a Windows scheduled task to run it every day or week (whatever is best for your needs).

If you make the entire workbook file read-only, then people won't be able to change anything within it. That will help to "freeze" the workbook to whatever its condition is on a particular date.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13117) applies to Microsoft Excel 2007, 2010, and 2013.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Changing Axis Tick Marks

Create a chart in Excel, and you may find that the tick marks shown on the axes in the chart aren't to your liking. It is ...

Discover More

Deleting Worksheet Code in a Macro

When creating an application in VBA for others to use, you might want a way for your VBA code to modify or delete other ...

Discover More

Patterns of Numbers with a Formula

Want to create a sequential pattern using formulas? It's easy to do if you take a look at how your data repeats. This tip ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Preventing Someone from Recreating a Protected Worksheet

When you share a protected workbook with other people, you may not want them to get around the protection by creating a ...

Discover More

Unlocking a Worksheet with an Unknown Password

It is not unusual, in a corporate world, to be handed a worksheet whose source you don't know. If that worksheet is ...

Discover More

Inserting and Deleting Rows in a Protected Worksheet

You've protected and saved your worksheet with explicit instructions that you be allowed to insert and delete rows. But ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is three less than 9?

2019-02-20 02:36:26


Hi Allen W. ,
Isn't Possible to do this By a Macro Code When Date and Time reaches its Limit to Do:
1- Save a Backup Copy of the Excel File only once, First .
2- and also make a Saved as Copy by a New name for that Excel File only once, second.
3- Then Letting the Original Copy under Share Continues ... users making changes .... etc.
4- and The manager of the Original Sheet tracks what is going on relative to the backup / or
saved as Copy of the work-book ?
In my Opinion he/she may want to do this.
Thanks and Regards.

2019-02-19 08:29:40

Patrick Verhaeghe

Read- only sounds great, only, if you know where to look, it can simply been undone, no?

2014-05-25 23:29:33


I have had a similar situation and have used this basic process.

1 – In the workbook I have 2 sheets:
a) the main data sheet that has all the information in it
b) one other data sheet that is locked from editing and apart from a simple text message has nothing else in it.

The main data sheet is hidden using the ‘very hidden’ function which prevents the users from unhiding it.

The other sheet with the message in it simply informs the user that to able to review the data in this spreadsheet they must first activate macros.

2 – I then have a macro in the workbook that is set to run automatically using the ‘auto_open’ macro name.
In this macro it does a couple things:
• It unhides the ‘very hidden’ main data sheet and hides the message text sheet also using the very hidden function.
• It checks the system data, and if that date is past a nominated cutoff date it then locks the sheet from changes.

If the user does not activate macros, they get only the message sheet and cannot see the data that they would want to see.

One problem with this is that you also need to disable the normal save and save as functions and replace them with another macro ‘save’ function where that macro will:
• unhide the very hidden message sheet
• hide the main data sheet using the very hidden function
• save the changes (if the user had made any … which was only available if that control date had not yet been reached)
• close the workbook

Maybe something like this can help with your situation.

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.