Applies To
By default, protecting a worksheet locks all cells so none of them are editable. To enable some cell editing, while leaving other cells locked, it’s possible to unlock all the cells. You can lock only specific cells and ranges before you protect the worksheet and, optionally, enable specific users to edit only in specific ranges of a protected sheet.
Lock only specific cells and ranges in a protected worksheet
Follow these steps:
- If the worksheet is protected, do the following:
- On the Review tab, select Unprotect Sheet (in the Protect group).
Select Protect Sheet to change to Unprotect Sheet when a worksheet is protected.
- If prompted, enter the password to unprotect the worksheet.
- On the Review tab, select Unprotect Sheet (in the Protect group).
- Select the whole worksheet by selecting Select All.
- On the Home tab, select the Font Settings popup launcher. You can also press Ctrl+Shift+F or Ctrl+1.
- In the Format Cells dialog box, select the Protection tab and uncheck the Locked box and then select OK.
This unlocks all the cells on the worksheet when you protect the worksheet. Now, you can choose the cells you specifically want to lock.
- On the worksheet, select only the cells that you want to lock.
- Bring up the Format Cells popup window again (Ctrl+Shift+F).
- This time, on the Protection tab, check the Locked box and then select OK.
- On the Review tab, select Protect Sheet.
- In the Allow all users of this worksheet to list, choose the elements that you want users to be able to change.More information about worksheet elementsClear this check boxTo prevent users fromSelect locked cellsMoving the pointer to cells for which the Locked check box is selected on the Protection tab of the Format Cells dialog box. By default, users are allowed to select locked cells.Select unlocked cellsMoving the pointer to cells for which the Locked check box is cleared on the Protection tab of the Format Cells dialog box. By default, users can select unlocked cells, and they can press the TAB key to move between the unlocked cells on a protected worksheet.Format cellsChanging any of the options in the Format Cells or Conditional Formatting dialog boxes. If you applied conditional formats before you protected the worksheet, the formatting continues to change when a user enters a value that satisfies a different condition.Format columnsUsing any of the column formatting commands, including changing column width or hiding columns (Home > Format).Format rowsUsing any of the row formatting commands, including changing row height or hiding rows (Home > Format).Insert columnsInserting columns.Insert rowsInserting rows.Insert hyperlinksInserting new hyperlinks, even in unlocked cells.Delete columnsDeleting columns.If Delete columns is protected and Insert columns is not also protected, a user can insert columns that they cannot delete.Delete rowsDeleting rows.If Delete rows is protected and Insert rows is not also protected, a user can insert rows that they cannot delete.SortUsing any commands to sort data (Data tab, Sort & Filter group).Users can’t sort ranges that contain locked cells on a protected worksheet, regardless of this setting.Use AutoFilterUsing the drop-down arrows to change the filter on ranges when AutoFilters are applied.Users cannot apply or remove AutoFilters on a protected worksheet, regardless of this setting.Use PivotTable reportsFormatting, changing the layout, or otherwise modifying PivotTable reports, or creating new reports.Edit objectsDoing any of the following:
- Making changes to graphic objects including maps, embedded charts, shapes, text boxes, and controls that you did not unlock before you protected the worksheet. For example, if a worksheet has a button that runs a macro, you can select the button to run the macro, but you cannot delete the button.
- Making any changes, such as formatting, to an embedded chart. The chart continues to be updated when you change its source data.
- Adding or editing comments.
- In the Password to unprotect sheet box, type a password for the sheet, select OK, and then retype the password to confirm it.
- The password is optional. If you do not supply a password, any user can unprotect the sheet and change the protected elements.
- Make sure that you choose a password that is easy to remember, because if you lose the password, you won’t have access to the protected elements on the worksheet.
Unlock ranges on a protected worksheet for users to edit
To give specific users permission to edit ranges in a protected worksheet, your computer must be running Microsoft Windows XP or later, and your computer must be in a domain. Instead of using permissions that require a domain, you can also specify a password for a range.
- Select the worksheet that you want to protect.
- Select Review > Allow Edit Ranges.
This command is available only when the worksheet is not protected.
- Do one of the following on the Allow Users to Edit Ranges dialog box:
- To add a new editable range, select New.
- To modify an existing editable range, select it in the Ranges unlocked by a password when sheet is protected box, and then select Modify.
- To delete an editable range, select it in the Ranges unlocked by a password when sheet is protected box, and then select Delete.
- In the Title box, type the name for the range that you want to unlock.
- In the Refers to cells box, type an equal sign (=), and then type the reference of the range that you want to unlock.You can also select the Collapse Dialog button, select the range in the worksheet, and then select the Collapse Dialog button again to return to the dialog box.
- For password access, in the Range password box, type a password that allows access to the range.Specifying a password is optional when you plan to use access permissions. Using a password allows you to see user credentials of any authorized person who edits the range.
- For access permissions, select Permissions, and then select Add.
- In the Enter the object names to select (examples) box, type the names of the users you want to be able to edit the ranges.To see how usernames should be entered, select examples. To verify that the names are correct, select Check Names.
- Select OK.
- To specify the type of permission for the user you selected, in the Permissions box, select or clear the Allow or Deny check boxes, and then select Apply.
- Select OK two times.If prompted for a password, type the password that you specified.
- In the Allow Users to Edit Ranges dialog box, select Protect Sheet.
- In the Allow all users of this worksheet to list, select the elements that you want users to be able to change.More information about the worksheet elementsClear this check boxTo prevent users fromSelect locked cellsMoving the pointer to cells for which the Locked check box is selected on the Protection tab of the Format Cells dialog box. By default, users are allowed to select locked cells.Select unlocked cellsMoving the pointer to cells for which the Locked check box is cleared on the Protection tab of the Format Cells dialog box. By default, users can select unlocked cells, and they can press the TAB key to move between the unlocked cells on a protected worksheet.Format cellsChanging any of the options in the Format Cells or Conditional Formatting dialog boxes. If you applied conditional formats before you protected the worksheet, the formatting continues to change when a user enters a value that satisfies a different condition.Format columnsUsing any of the column formatting commands, including changing column width or hiding columns (Home > Format).Format rowsUsing any of the row formatting commands, including changing row height or hiding rows (Home > Format).Insert columnsInserting columns.Insert rowsInserting rows.Insert hyperlinksInserting new hyperlinks, even in unlocked cells.Delete columnsDeleting columns.If Delete columns is protected and Insert columns is not also protected, a user can insert columns that they cannot delete.Delete rowsDeleting rows.If Delete rows is protected and Insert rows is not also protected, a user can insert rows that they cannot delete.SortUsing any commands to sort data (Data tab, Sort & Filter group).Users can’t sort ranges that contain locked cells on a protected worksheet, regardless of this setting.Use AutoFilterUsing the drop-down arrows to change the filter on ranges when AutoFilters are applied.Users cannot apply or remove AutoFilters on a protected worksheet, regardless of this setting.Use PivotTable reportsFormatting, changing the layout, or otherwise modifying PivotTable reports, or creating new reports.Edit objectsDoing any of the following:
- Making changes to graphic objects including maps, embedded charts, shapes, text boxes, and controls that you did not unlock before you protected the worksheet. For example, if a worksheet has a button that runs a macro, you can select the button to run the macro, but you cannot delete the button.
- Making any changes, such as formatting, to an embedded chart. The chart continues to be updated when you change its source data.
- Adding or editing comments.
- In the Password to unprotect sheet box, type a password, select OK, and then retype the password to confirm it.
- The password is optional. If you do not supply a password, then any user can unprotect the worksheet and change the protected elements.
- Make sure that you choose a password that you can remember. If you lose the password, you won’t have access to the protected elements on the worksheet.
- If a cell belongs to more than one range, users who are authorized to edit any of those ranges can edit the cell.
- If a user tries to edit multiple cells at once and is authorized to edit some but not all of those cells, the user is prompted to edit the cells one-by-one.