Excel Lock Cells
When people work in your worksheet, they may accidentally wipe out formulas or change things you don’t want changed, like titles or cell formatting. To prevent that, you can lock them out of certain cells and then protect the worksheet. You can lock all the cells in a worksheet or specific cells, allowing some parts of the spreadsheet to be changed.
Lock All the Cells in a Worksheet
By default, when you protect a sheet or workbook, all of the cells will be locked. This means they can’t be reformatted or deleted, and the content in them can’t be edited. By default, the locked cells can be selected, but you can change that in the protection options.
- Navigate to the Review tab.
- Click Protect Sheet. In the Protect Sheet window, enter a password that’s required to unprotect the sheet (optional) and any of the actions you want to allow users.
- Click OK to protect the sheet.
When you or anyone else tries to edit any of the locked cells, message will come up. The cells can only be unlocked when the sheet is unprotected (by going to the Review tab again, choosing "Unprotect Sheet," and entering the password, if required).
Lock Specific Cells in a Worksheet
There might be times when you want to lock certain cells from being changed but still allow users to adjust other cells in a worksheet. In our example, in an inventory list you might allow unit prices and stock quantities to be updated, but not the item IDs, names, or descriptions. As mentioned above, all cells are locked by default when you protect the sheet. However, you can specify whether a cell should be locked or unlocked in the cell’s format properties.
- Select all the cells you don’t want to be locked. These will be the cells that can be edited even after the sheet is protected.
Right-click on your selection, select Format Cells, and click on the Protection tab. Alternatively, under the Home tab, click on the expansion icon next to Alignment, and in the Format Cells window go to the Protection tab.
Uncheck "Locked" (which is checked by default) and click OK.
Go to Review > Protect Sheet and hit OK to protect the sheet. Any cells you didn’t unlock under the Format Cells option (step 3 above) will be locked, while the unlocked cells will be editable:
Note that cell locking (or unlocking) won’t take effect until you do step 4, protecting the sheet.
If you want to quickly lock or unlock cells that aren’t next to each other, you can use a keyboard shortcut. After selecting a cell or group of cells, use the Format Cells dialog as above to lock or unlock it. Then select your next cell(s) and hit F4 to repeat your last action.