Chapter 31. Protecting Your Work

IN THIS CHAPTER

Protecting worksheets

Protecting workbooks

Protecting Visual Basic Projects

Other related topics

The concept of "protection" gets a lot of attention in the Excel newsgroups and forums. It seems that many users want to learn how to protect their workbooks from being copied or modified. Excel has several protection-related features, and those features are covered in this chapter.

31.1. Types of Protection

Excel's protection-related features fall into three categories:

  • Worksheet protection: Protecting a worksheet from being modified, or restricting the modifications to certain users

  • Workbook protection: Protecting a workbook from having sheets inserted or deleted, and also requiring the use of password to open the workbook

  • Visual Basic (VB) protection: Using a password to prevent others from viewing or modifying your VBA code

Before I discuss these features, you should understand the notion of security. Using a password to protect some aspect of your work doesn't guarantee that it's secure. Password-cracking utilities (and some simple tricks) have been around for a long time. Using passwords work in the vast majority of cases, but if someone is truly intent on getting to your data, he or she can usually find a way. If absolute security is critical, perhaps Excel isn't the proper tool.


About Information Rights Management

Excel supports an Information Rights Management (IRM) feature, which allows you to specify access permissions for workbooks. Using IRM may help prevent sensitive information from being printed, e-mailed, or copied by unauthorized people. When IRM is applied to a workbook, the permission information is stored in the document file itself.

To use IRM, you must install the Microsoft Windows Rights Management Services (RMS) — an extra-cost product that isn't included with Microsoft Office. You can access the IRM settings by choosing File InfoProtect Workbooks Restrict Permission By People.

IRM is not covered in this book. If your company uses RMS, consult your system administrator for more information about how this feature is used within your organization.


31.2. Protecting a Worksheet

You may want to protect a worksheet for a variety of reasons. One reason is to prevent yourself or others from accidentally deleting formulas or other critical data. A common scenario is to protect a worksheet so that the data can be changed, but the formulas can't be changed.

To protect a worksheet, activate the worksheet and choose Review Changes Protect Sheet. Excel displays the Protect Sheet dialog box shown in Figure 31.1. Note that providing a password is optional. If you enter a password, that password will be required to unprotect the worksheet. If you accept the default options in the Protect Sheet dialog box (and if you haven't unlocked any cells), none of the cells on the worksheet can be modified.

To unprotect a protected sheet, choose Review Changes Unprotect Sheet. If the sheet was protected with a password, you're prompted to enter that password.

Figure 31.1. Use the Protect Sheet dialog box to protect a worksheet.

31.2.1. Unlocking cells

In many cases, you will want to allow some cells to be changed when the worksheet is protected. For example, your worksheet may have some input cells that are used by formula cells. In such a case, you would want the user to be able to change the input cells, but not the formula cells. Every cell has a Locked attribute, and that attribute determines whether the cell can be changed when the sheet is protected.

By default, all cells are locked. To change the locked attribute, select the cell or range, right-click, and choose Format Cells from the shortcut menu (or press Ctrl+1). The Protection tab of the Format Cells dialog box opens (see Figure 31.2); clear the Locked check box and then click OK.

Figure 31.2. Use the Protection tab in the Format Cells dialog box to change the Locked attribute of a cell or range.

NOTE

The Protection tab of the Format Cells dialog box has another attribute: Hidden. If this check box is selected, the contents of the cell don't appear in the Formula bar when the sheet is protected. The cell isn't hidden in the worksheet. You may want to set the Hidden attribute for formula cells to prevent users from seeing the formula when the cell is selected.

After you unlock the desired cells, choose Review Changes Protect Sheet to protect the sheet. After doing so, you can change the unlocked cells, but if you attempt to change a locked cell, Excel displays the warning alert shown in Figure 31.3.

Figure 31.3. Excel warns you if you attempt to change a locked cell.

31.2.2. Sheet protection options

The Protect Sheet dialog box has several options, which determine what the user can do when the worksheet is protected.

  • Select Locked Cells: If checked, the user can select locked cells using the mouse or the keyboard. This setting is enabled by default.

  • Select Unlocked Cells: If checked, the user can select unlocked cells using the mouse or the keyboard. This setting is enabled by default.

  • Format Cells: If checked, the user can apply formatting to locked cells.

  • Format Columns: If checked, the user can hide or change the width of columns.

  • Format Rows: If checked, the user can hide or change the height of rows.

  • Insert Columns: If checked, the user can insert new columns.

  • Insert Rows: If checked, the user can insert new rows.

  • Insert Hyperlinks: If checked, the user can insert hyperlinks (even in locked cells).

  • Delete Columns: If checked, the user can delete columns.

  • Delete Rows: If checked, the user can delete rows.

  • Sort: If checked, the user can sort data in a range as long as the range doesn't contain any locked cells.

  • Use AutoFilter: If checked, the user can use existing autofiltering.

  • Use PivotTable Reports: If checked, the user can change the layout of pivot tables or create new pivot tables.

  • Edit Objects: If checked, the user can make changes to objects (such as Shapes) and charts, as well as insert or delete comments.

  • Edit Scenarios: If checked, the user can use scenarios (see Chapter 36).

When the worksheet is protected and the Select Unlocked Cells option is set, pressing Tab moves to the next unlocked cell, making data entry much easier.


31.2.3. Assigning user permissions

Excel also offers the ability to assign user-level permissions to different areas on a protected worksheet. You can specify which users can edit a particular range while the worksheet is protected. As an option, you can require a password to make changes.

This feature is rarely used, and the setup procedure is rather complicated. But if you need this level of protection, setting it up might be worth the effort.

  1. Unprotect the worksheet if it's protected.

  2. Choose Review Changes Allow Users to Edit Ranges. The dialog box shown in Figure 31.4 opens.

  3. Follow the prompts in the series of dialog boxes that follow.

  4. Protect the sheet.

Figure 31.4. The Allow Users to Edit Ranges dialog box.

31.3. Protecting a Workbook

Excel provides three ways to protect a workbook:

  • Require a password to open the workbook.

  • Prevent users from adding sheets, deleting sheets, hiding sheets, and unhiding sheets.

  • Prevent users from changing the size or position of windows.

I discuss each of these methods in the sections that follow.

31.3.1. Requiring a password to open a workbook

Excel lets you save a workbook with a password. After doing so, whoever tries to open the workbook must enter the password.

To add a password to a workbook, follow these steps:

  1. Choose File Info Protect Workbook Encrypt With Password. Excel displays the Encrypt Document dialog box shown in Figure 31.5.

  2. Type a password and click OK.

  3. Type the password again and click OK.

  4. Save the workbook.

Figure 31.5. Specify a workbook password in the Encrypt Document dialog box.

NOTE

You need to perform these steps only one time. You don't need to specify the password every time you resave the workbook.

To remove a password from a workbook, repeat the same procedure. In Step 2, however, delete the existing password symbols from the Encrypt Document dialog box, click OK, and save your workbook.

Figure 31.6 shows the Password dialog box that appears when you try to open a file saved with a password.

Figure 31.6. Opening this workbook requires a password.

Excel provides another way to add a password to a document:

  1. Choose Office Save As.

  2. In the Save As dialog box, click the Tools button and choose General Options. Excel displays the General Options dialog box.

  3. In the General Options dialog box, enter a password in the Password to Open field.

  4. Click OK. You're asked to re-enter the password before you return to the Save As dialog box.

  5. In the Save As dialog box, make sure that the filename, location, and type are correct; then click Save.

NOTE

The General Options dialog box has another password field: Password to Modify. If you specify a password for this field, the file opens in read-only mode (it can't be saved under the same name) unless the user knows the password. If you use the Read-Only Recommended check box without a password, Excel suggests that the file be opened in read-only mode, but the user can override this suggestion.

31.3.2. Protecting a workbook's structure

To prevent others (or yourself) from performing certain actions in a workbook, you can protect the workbook's structure. When a workbook's structure is protected, the user may not

  • Add a sheet.

  • Delete a sheet.

  • Hide a sheet.

  • Unhide a sheet.

  • Rename a sheet.

  • Move a sheet.

To protect a worksheet's structure

  1. Choose Review Changes Protect Workbook to display the Protect Workbook dialog box (see Figure 31.7).

  2. In the Protect Workbook dialog box, select the Structure check box.

  3. (Optional) Enter a password.

  4. Click OK.

To unprotect the workbook's structure, choose Review Changes Unprotect Workbook. If the workbook's structure was protected with a password, you are prompted to enter the password.

Figure 31.7. The Protect Workbook dialog box.

31.3.3. Protecting a workbook's windows

To prevent others (or yourself) from changing the size or position of a workbook's windows, you can protect the workbook's windows:

  1. Choose Review Changes Protect Workbook.

  2. In the Protect Workbook dialog box, select the Windows check box.

  3. (Optional) Enter a password.

  4. Click OK.

When a workbook's windows are protected, the user can't change anything related to the window size or position. For example, if the workbook window is maximized when the windows are protected, the user cannot unmaximize the window. The windows can, however, be zoomed.

To unprotect the workbook's windows, choose Review Changes Unprotect Workbook. If the workbook's windows were protected with a password, you are prompted to enter the password.

31.4. VB Project Protection

If your workbook contains any VBA macros, you may want to protect the VB Project to prevent others from viewing or modifying your macros. Another reason to protect a VB Project is to prevent its components from being expanded in the VB Editor Project window (which can avoid clutter while you're working on other VB project). To protect a VB Project

  1. Press Alt+F11 to activate the VB Editor.

  2. Select your project in the Projects window.

  3. Choose Tools - xxxx Properties (where xxxx corresponds to your Project name). Excel displays the Project Properties dialog box.

  4. In the Project Properties dialog box, click the Protection tab (see Figure 31.8).

  5. Select the Lock Project for Viewing check box.

  6. Enter a password (twice).

  7. Click OK and then save your file. When the file is closed and then re-opened, a password will be required to view or modify the VBA code.

Figure 31.8. Protecting a VB Project with a password.

NOTE

Part VI discusses VBA macros.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset