Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Protecting Worksheets from Deletion.
Written by Allen Wyatt (last updated June 29, 2024)
This tip applies to Excel 97, 2000, 2002, and 2003
Chris has a workbook composed of two control worksheets that contain setup data. The workbook's user runs macros that create many new worksheets in the workbook. The user then deletes any unwanted worksheets. Chris wants to make sure that the two control worksheets aren't deleted by mistake.
This can be accomplished, to some extent, by protecting the structure of the workbook, as described in other ExcelTips. This protects the workbook structure from being changed, such that the user can't add or delete worksheets. Since you want the user able to add and delete worksheets, you'd need to make two changes to how the workbook is used:
Another approach is to create duplicates of the control sheets in the workbook. Make these worksheets hidden, which protects them to a degree. Your macros could then check to see if the non-hidden control sheets were deleted. If they were, then the macro could create another control sheet by copying the hidden version of the control sheets.
Still another approach is to modify the macro that currently adds a bunch of worksheets to the workbook. The modification would create a "backup" workbook that contains the controls sheets. Later, before closing the workbook, a macro can be invoked that checks for the control sheets. If they are not present, then the macro copies them from the backup workbook. If they are present, then the backup workbook can be deleted.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3267) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Protecting Worksheets from Deletion.
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!
Excel allows you to protect worksheets, individually. Users can still see that the worksheets are there, but they cannot ...
Discover MoreWhen you first create a worksheet, all the cells in that worksheet are formatted as locked. As you unlock various cells ...
Discover MoreNeed to make sure that your worksheet is locked, with only the blank cells accessible to editing? You can do this easily ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments