Tom has a workbook with a number of worksheets and he only wants to protect the first worksheet against changes. Consequently, he would like to save the workbook with all changes except any made to that first worksheet.
Excel provides the ability to protect individual worksheets in a workbook. Without going into too much detail (as this has been covered in other issues of ExcelTips), you can protect a worksheet by displaying the Home tab of the ribbon, clicking Format in the Cells group, and then choosing Protect Sheet.
If this type of protection is not enough, then you are pretty much entering the realm of macros. Let's say that the name of the worksheet you want to protect is ImportantStuff. (Creative name, I know.) The idea would be to create a copy of the ImportantStuff worksheet as you want it to always appear. Name this copy something like KeepImportantStuff. Hide the KeepImportantStuff worksheet, and then use an AutoClose macro to (1) delete the ImportantStuff worksheet, since it may have been changed by the user; (2) duplicate the KeepImportantStuff worksheet, naming the copy ImportantStuff; and (3) saving and closing the workbook.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11727) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Protecting a Single Worksheet.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Got a workbook with a lot of worksheets in it? Here are some handy ways to jump to the worksheet you want, alphabetically.
Discover MoreNeed to set up a workbook that includes a worksheet for each week of the year? Here's a couple of quick macros that can ...
Discover MoreIf you've got a lot of worksheets in your workbook, you may want to display their tabs in to rows at the bottom of the ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2017-09-26 03:56:28
Gerhard Schweizer
The macro outlined here will fail if other worksheets in the workbook contain references to cells (or named ranges) on ImportantStuff. Instead, one could first rename (not copy) ImportantStuff to KeepImportantStuff, i.e. all references remain intact. Then, make a copy of this sheet, name it ImportantStuff and hide KeepImportantStuff. At AutoClose, continue as desribed. Thus, references always point to the 'eternal' sheet.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2023 Sharon Parq Associates, Inc.
Comments