Locking cells in Excel prevents others from editing or deleting specific data while still allowing changes to other parts of the sheet. The key to understanding this feature is that cell locking only takes effect after you protect the worksheet. By default, all cells are marked as “locked,” but they aren’t actually locked until you turn on sheet protection. To lock only certain cells, you first unlock the entire sheet, then lock the specific cells you want to protect, and finally enable protection. Here’s the complete process.
What You’ll Need
- Microsoft Excel (Microsoft 365, Excel 2021, 2019, 2016, or earlier versions; steps are similar on Mac and Excel for the web)
- A worksheet with data you want to protect
- Optional: a password to prevent others from unprotecting the sheet
Step-by-Step
- Select the entire worksheet. Click the triangle at the top-left corner of the sheet (where the row numbers and column letters meet) or press Ctrl+A (Windows) or Cmd+A (Mac).
- Open the Format Cells dialog. Right-click any selected cell and choose Format Cells, or press Ctrl+1 (Windows) / Cmd+1 (Mac).
- Go to the Protection tab. In the dialog box, click the Protection tab.
- Uncheck “Locked.” Uncheck the Locked checkbox and click OK. This unlocks every cell in the worksheet, preparing it for selective locking.
- Select the cells you want to lock. Click and drag to highlight the specific cells or ranges (e.g., A1:C10). To select non-adjacent cells, hold Ctrl (Windows) or Cmd (Mac) while clicking.
- Reopen Format Cells for the selected cells. Right-click the selected area and choose Format Cells, or press Ctrl+1 / Cmd+1.
- Check the “Locked” box. On the Protection tab, check the Locked checkbox and click OK. Now only these cells are marked as locked.
- Protect the worksheet. Go to the Review tab on the ribbon and click Protect Sheet (in the Changes group).
- Set options and password (optional). In the Protect Sheet dialog, you can choose what users can do (e.g., select locked cells, format rows). If you want to prevent others from unprotecting, type a password in the “Password to unprotect sheet” field. Click OK and re-enter the password if prompted.
- Test your lock. Try clicking on a locked cell and typing. You should see a message saying the cell is protected. Unlocked cells should still be editable.
Common Mistakes
- Forgetting to protect the sheet. Locking cells without protecting the sheet does nothing—the cells remain editable. Always finish with Protect Sheet.
- Locking all cells inadvertently. If you skip the “unlock all” step, every cell will be locked after protection, making the whole sheet read-only.
- Using the wrong menu. The Protection tab is in the Format Cells dialog, not in the Home tab’s Format dropdown (though the dropdown does have a “Lock Cell” toggle—but it doesn’t protect the sheet).
- Not considering hidden formulas. If you lock cells containing formulas, users can’t see the formula bar content unless you also check “Hidden” in the Protection tab. That’s a separate option.
- Setting a password and forgetting it. There’s no way to recover a lost sheet protection password in Excel. Write it down or store it securely.
Tips
- Use the “Select locked cells” option wisely. By default, users can select locked cells even if they can’t edit them. If you uncheck this, they can’t even click on them—useful for a clean input area.
- Lock only input ranges. A common pattern is to lock formula cells and leave input cells unlocked. That way, users can enter data but can’t accidentally overwrite calculations.
- Protect multiple sheets at once. Hold Ctrl while clicking sheet tabs to select several sheets, then apply protection to all at once.
- Use the “Allow Users to Edit Ranges” feature. If you have a shared workbook, you can set specific ranges that certain users can edit without a password. Go to Review > Allow Edit Ranges.
- Unprotect quickly. To make changes later, go to Review > Unprotect Sheet and enter the password if set.
Troubleshooting
Cells are still editable after locking. You likely forgot to protect the sheet. Go to Review > Protect Sheet and ensure the “Protect worksheet and contents of locked cells” checkbox is checked.
All cells are locked when you protect the sheet. This happens if you didn’t unlock the entire worksheet first. Reopen the sheet, select all cells, and uncheck “Locked” in Format Cells, then re-lock only the desired range.
You can’t select locked cells. In the Protect Sheet dialog, check the “Select locked cells” option if you want users to be able to click on them. If it’s grayed out, unprotect the sheet first, adjust the option, and re-protect.
Password forgotten. Unfortunately, Excel doesn’t offer a built-in recovery for sheet protection passwords. You could try third-party recovery tools, but they may not work with modern Excel files. Always keep a copy of the password in a safe place.
Locking doesn’t work on Excel for the web. The steps are the same, but note that you must protect the sheet from the Review tab. Also, some advanced options (like “Allow Edit Ranges”) aren’t available in the web version.
Frequently Asked Questions
Q: Can I lock only certain cells without protecting the whole sheet?
A: No. Cell locking only takes effect when the sheet is protected. However, you can protect the sheet and still allow editing of unlocked cells.
Q: How do I lock cells but allow sorting or filtering?
A: In the Protect Sheet dialog, check the options “Sort” and “Use AutoFilter” to allow those actions even on locked cells.
Q: Will locking cells prevent someone from deleting a row or column?
A: No, locking cells only prevents editing the cell contents. Deleting rows or columns is controlled by sheet protection options—uncheck “Delete columns” and “Delete rows” in the Protect Sheet dialog to prevent that.
Q: Can I lock cells in a shared workbook?
A: Yes, but you must protect the sheet after sharing. Note that some features, like merging cells, may be restricted in shared workbooks.
Q: How do I hide formulas while locking cells?
A: Select the cells, open Format Cells > Protection, check both “Locked” and “Hidden,” then protect the sheet. The formula bar will be blank for those cells.
Q: Is there a keyboard shortcut to lock cells?
A: No direct shortcut exists for locking. You can use Ctrl+1 to open Format Cells, then navigate to the Protection tab.
Related
- How to Export a File as EPS (Illustrator, InDesign, Photoshop)
- DS18DSAL 18V Compact Pro Driver Drill Hitachi Review
- Select All Windows Explorer: Steps & Tips
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Remove Formatting in Word 365: A Step-by-Step GuideTo remove formatting in Word 365, select the text and choose Home > Clear All Formatting to strip…
- Conditional Formatting Greyed Out? Excel FixesIf Conditional Formatting is greyed out in Excel for Microsoft 365 on Windows, first check whether you are…
- How to Calculate a Monthly Loan Payment in ExcelTo calculate a monthly loan payment in Microsoft Excel, use the PMT function: with the loan amount in…
- How to Move Cells Down in Excel Without Overwriting DataTo move cells down in Excel and make room, select the cells that should shift, choose Home >…
- Excel Unmerge Cells and Fill Every Cell with Its DataTo unmerge cells in Excel for Microsoft 365 on Windows, select the merged range and choose Home >…
- How to Select Cells in Excel With Keyboard ShortcutsTo select cells in Excel with the keyboard, move to a starting cell with the arrow keys, then…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.