Skip to main content

How to Lock Cells in Excel

You've worked hard on your spreadsheet and now you want to make sure anyone you share it with doesn't inadvertently change cells that shouldn't be changed. Thankfully, Microsoft Excel 2016 and earlier versions let you lock cells to protect them from being modified on Windows 10. You can lock all the cells in a worksheet or specific cells, allowing some parts of the spreadsheet to be changed. Here's how to lock cells in Excel.

Editor's Note: This tutorial was written for Excel 2016, but still applies to modern versions of Excel.

How to Lock All the Cells in an Excel 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.

1. Navigate  to the Review tab.

2. 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.

3. Click OK to protect the sheet.

When you or anyone else tries to edit any of the locked cells, this 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).

How to Lock Specific Cells in an Excel 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.

1. 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.

2. 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.)

3. Uncheck "Locked" (which is checked by default) and click OK.

4.  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.

Protip: 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.