Protection: Preventing Changes to a Pivot Table

Một phần của tài liệu Excel 2007 PivotTables Recipes (Trang 172 - 175)

Problem

You want to prevent users from making any changes to the pivot table. They should be able to view the pivot table, but not change the selected items, type over any of the field names, or rearrange the layout. However, you want users to be able to make changes to data and formulas in other areas of the worksheet. This problem is based on the PivotProtect.xlsx sample file.

Solution

If you protect the worksheet without enabling pivot table use, users won’t be able to modify the pivot table.

Preparing the Worksheet

When protecting a worksheet, prepare the sheet first by unlocking cells where changes can be made. Then, turn on the worksheet protection.

To prepare the sheet, follow these steps:

1. Select any cells in which users are allowed to make changes. In the sample file, users can make changes to cell E2.

2. On the Ribbon, click the Home tab.

3. In the Cells group, click Format. The Lock Cell command is enabled if the active cell is locked (see Figure 8-3). To unlock the cells, click Lock Cell.

Figure 8-3.The Lock Cell command is enabled.

Protecting the Worksheet

After you prepare the worksheet, follow these steps to protect the worksheet:

1. On the Ribbon, click the Review tab, and then in the Changes section, click Protect Sheet.

2. If desired, enter a password. If you don’t enter a password, the worksheet will be pro- tected, but it can be unprotected simply by clicking Unprotect Sheet on the Review tab on the Ribbon.

3. Remove the check mark from Use PivotTable Reports, and then check the items you want enabled on the protected worksheet (see Figure 8-4).

Figure 8-4.Select items to enable on a protected worksheet.

4. Click OK and confirm the password, if one was entered.

How It Works

When you protect the worksheet, you can allow or disallow Use PivotTable Reports. With either choice, if the worksheet is protected, use of the pivot table is affected.

Not Allowing Use PivotTable Reports

If the worksheet is protected, and Use PivotTable Reports was not selected in the Protect Sheet dialog box, users won’t be able to make any changes to the pivot tables on the worksheet. For example, they won’t be able to open the drop-down lists on the pivot field buttons, move fields, remove fields, or add fields. The PivotTable Field List will be hidden.

You can create a pivot chart from a pivot table on the protected sheet, but you won’t be able to change the pivot chart layout or use the PivotChart filter. You can change the pivot chart formatting, chart type, and chart options. If you allow users to Edit Objects on the protected sheet, a pivot chart can be inserted on the protected sheet. If Edit Objects was not checked, you can create an empty chart on an unprotected sheet, and change its source to the pivot table.

Other pivot tables, based on the same Excel Table as the pivot tables on a protected sheet, will have some features disabled, such as Refresh.

Tip If you use worksheet protection to disable the pivot table, many other features of the worksheet are also disabled, such as AutoSum, Spelling, Subtotals, and Creating or refreshing a pivot table. If these fea- tures are required on the worksheet, you may prefer to use programming to protect the pivot table, while leaving the worksheet unprotected.

Allowing Use PivotTable Reports

If you enable pivot table use when protecting the worksheet, users can open the drop-down lists on the pivot field buttons, move the fields, remove fields, and add fields. The PivotTable Field List can be shown. Users can work with existing pivot tables, but they can’t create a new pivot table on the protected sheet or refresh existing pivot tables.

Note When enabling PivotTable report use, you can’t control which pivot table features are allowed. If you want to enable some features, such as selecting items from the Pivot field drop-down lists, and disable other features, such as changing the layout, you can use programming, as described in Chapter 11.

Even with the Use PivotTable Reports setting turned on, many commands are disabled if the worksheet is protected, including the following:

• Report Layout

• Refresh

• Group and Ungroup

• PivotTable Options

• Show Report Filter Pages

• Calculated Field

• Calculated Item

• Enable Selection

• PivotTable Styles

Tip To refresh the pivot table, the worksheet owner can temporarily unprotect the worksheet, refresh the pivot table, and then protect the sheet.

Một phần của tài liệu Excel 2007 PivotTables Recipes (Trang 172 - 175)

Tải bản đầy đủ (PDF)

(259 trang)