Lock Cells

Every cell in a new workbook is already set to Locked, and that setting does nothing at all until sheet protection is switched on. Locking a few cells is therefore mostly a matter of unlocking the rest: select the whole sheet with Ctrl+A, press Ctrl+1 > Protection and clear the Locked box, then select just the cells that must stay fixed, tick Locked again, and finish with Review > Protect Sheet. Only that last step makes any of it take effect.

The formula

1. Ctrl+A                         select every cell on the sheet
2. Ctrl+1 > Protection            clear the "Locked" tick box, OK
3. select the cells to protect    Ctrl+1 > Protection, tick "Locked" again
4. Review > Protect Sheet         choose what stays allowed, password optional, OK
   Review > Unprotect Sheet       to edit the protected cells again

A worked example

A data-entry sheet where colleagues fill in B2:B20 and the rate table in D2:D20 must not be touched.

Ctrl+A > Ctrl+1 > Protection > untick Locked; select D2:D20 > Ctrl+1 > Protection > tick Locked; Review > Protect Sheet

Typing in B2:B20 works exactly as before, while any edit to D2:D20 raises "The cell or chart you are trying to change is on a protected sheet". Skip the first step and the entire sheet becomes read-only, because every cell was Locked from the start.

Which one do I need?

If you want to…Use
Stopping people editing certain cells while the rest stays openUnlock everything first (Ctrl+A > Ctrl+1 > Protection), re-lock only those cells, then Review > Protect Sheet
Keeping a header row or first column on screen while you scrollThat is Freeze Panes, not protection: View > Freeze Panes > Freeze Top Row
Stopping a reference from shifting when you copy a formulaThat is an absolute reference — press F4 to add the dollar signs, as in =$B$1*A2
Getting back into a sheet that is already protectedReview > Unprotect Sheet, with the password it was protected with
Stopping anyone opening the file at all without a passwordFile > Info > Protect Workbook > Encrypt with Password — a file-level lock, unrelated to cell protection
Doing the same thing in Google SheetsSheets has no Locked attribute: Data > Protect sheets and ranges names a range and says who may edit it

Frequently asked questions

Why is my whole sheet locked when I only locked one cell?

Because every cell was Locked before you started — protecting the sheet simply begins enforcing that on all of them. Unprotect the sheet (Review > Unprotect Sheet), select all with Ctrl+A, clear the Locked box under Ctrl+1 > Protection, then tick it again on only the cells you meant to fix, and protect the sheet a second time.

Do I have to set a password to protect a sheet?

No. Protect Sheet works with the password box left empty, which is enough to stop accidental edits while letting anyone deliberately lift it. A password only matters when colleagues should not be able to click Unprotect Sheet themselves — and Excel offers no recovery route if you forget it, so record it somewhere before you commit.

How do I lock a row so it stays visible while I scroll?

That is Freeze Panes, a different feature with a similar name. View > Freeze Panes > Freeze Top Row pins row 1; selecting a cell first and choosing Freeze Panes pins everything above and to the left of it. It changes nothing about who may edit those cells — the row is still fully editable.

Can people still sort and filter a protected sheet?

Only if you allow it. The Protect Sheet dialog carries a checklist of actions that stay permitted — Select unlocked cells, Sort, Use AutoFilter, Format columns and so on — and everything unticked is blocked. Tick Sort and Use AutoFilter before pressing OK, and note that sorting still needs the cells being moved to be unlocked.