Independent tech help — Sylvan Lake, AlbertaChecked against vendor documentationBrowse every fix ↗
The Tech Cell
Tech problems, solved
Computers & devices6 min

How to Lock a Row in Excel (Three Different Jobs)

Locking a row in Excel means unlocking the sheet first, then re-locking just the row and protecting it. Here is the exact order, plus the two settings people confuse it with.

How to Lock a Row in Excel (Three Different Jobs)

To stop anyone editing a row, select the whole sheet and clear Locked in Format Cells, then select just that row, tick Locked again, and run Review > Protect Sheet. Nothing is actually locked until the sheet is protected. If you wanted the row to stay on screen while you scroll instead, that is Freeze Panes, which is a different menu entirely.

There are three different answers to how to lock a row in Excel, and they solve unrelated problems. One stops people typing in the row. One keeps the row visible while you scroll. One stops a row number shifting when you copy a formula. Excel files all three under different names, which is why the menu is hard to find.

This guide covers the first one, because it is what most people mean: making a row read-only so a colleague cannot overwrite it. The last section explains how to tell the other two apart, so you do not spend ten minutes in the wrong menu.

How to lock a row in Excel against editing

Here is the part that trips everyone up. Every cell in a new worksheet is already marked as Locked. That setting does nothing on its own. It only starts working when you protect the sheet, and at that moment the entire sheet goes read-only, not just the row you had in mind.

So the real job is backwards from what you would expect: unlock everything first, then re-lock only the row you want frozen out.

  1. Press Ctrl + A to select the whole worksheet. On a Mac, Command + A.
  2. Press Ctrl + 1 (Command + 1 on a Mac) to open Format Cells. Open the Protection tab and clear the Locked checkbox, then click OK. Every cell on the sheet is now editable.
  3. Click the row header for the row you want to lock, the grey number at the far-left edge. The whole row highlights.
  4. Press Ctrl + 1 again, return to the Protection tab, and this time tick Locked. Click OK.
  5. Go to the Review tab and click Protect Sheet.
  6. In the Allow all users of this worksheet to list, leave Select locked cells and Select unlocked cells ticked so people can still click around the sheet. A password is optional. Click OK.

Test it before the file goes anywhere. Click a cell in the locked row and start typing: Excel refuses the edit and shows a message. Click any other row and it accepts input as normal.

To undo it, return to the Review tab. The button now reads Unprotect Sheet rather than Protect Sheet, which is also the quickest way to check whether a sheet is protected at all. You can reach the same command from File > Info > Protect. If you set a password, you need it here, and Microsoft is explicit that it cannot retrieve a lost one. Use something you have written down.

The faster route, and what changes on a Mac

There is a second way to lock a row in Excel, and it works the other way around. Leave every cell locked, then nominate the ranges people are allowed to edit. It saves the select-all step when you are locking one row in a large sheet.

On the Review tab, click Allow Edit Ranges, then New, and enter the range that should stay editable. Turn on Protect Sheet afterwards as usual. Your row stays locked because you never unlocked it, and you skip the select-all step.

Allow Edit Ranges is Windows-only. There is no equivalent button on the Review tab in Excel for Mac, so Mac users should use the six-step method above, which works identically on both platforms.

What this does not do

Protecting a sheet is not a security feature, and Microsoft says so in plain terms. It stops accidental edits by someone working in the file. It is not the same as putting a password on the file itself, and it is not designed to resist anyone determined to get past it.

It also does not keep the row on screen. If what you actually wanted was a header row that stays put while the rest of the sheet scrolls underneath it, that is Freeze Panes, on the View tab: View > Freeze Panes > Freeze Top Row for row 1, or select the cell below the rows you want held and choose Freeze Panes. We have walked through that one separately in how to pin a row in Excel. A frozen row is still fully editable; the two settings do not overlap.

And it does not lock a row reference inside a formula. That is the dollar sign. Typing A$1 instead of A1 keeps the row number fixed when you copy the formula down, while the column can still change. The keyboard shortcut to cycle through the options while editing a formula is F4 on Windows and Command + T on a Mac.

Finally, to lock a row in Excel is not to hide it. The contents stay in full view; they just stop accepting changes.

Common questions

Can people still sort and filter? Only if you let them. The Allow all users of this worksheet to list in the Protect Sheet dialog includes Sort and Use AutoFilter among its checkboxes, alongside options for formatting, inserting and deleting rows and columns. Tick whatever the sheet needs before you click OK.

Do I have to set a password? No. Leaving the password box empty still protects the sheet. Anyone can then lift the protection from the Review tab, which is usually enough when the point is preventing accidents rather than stopping people.

Can I lock several rows at once? Yes. At step three, hold Ctrl and click each row header you want included, then carry on. The Locked setting applies to every selected cell.

If Protect Sheet isn't there

If the Review tab shows Unprotect Sheet instead, the sheet is already protected. Click it, make your changes, and protect it again afterwards.

If the Protection tab is missing from Format Cells, or the protection commands are greyed out, you are most likely not in the desktop app. Check whether the file is open in a browser or a mobile app rather than Excel for Windows or Mac, and reopen it on the desktop. Worksheet protection is also sheet-by-sheet, so protecting one tab leaves every other tab in the workbook wide open; repeat the steps on each sheet that needs it.

Daniel Shuttleworth
Written by

Daniel Shuttleworth

Editor · Sylvan Lake, Alberta

Daniel Shuttleworth studied Advanced Information Communication Technology and has spent more than 20 years working out why consumer tech misbehaves — from an Amiga 600 and a VHS deck through to whatever Xbox and Samsung shipped this year. He writes The Tech Cell from Sylvan Lake, Alberta, and checks every step against the vendor's current documentation before it goes out, because the menu that worked last spring has usually moved.

Filed under · Computers & devices← Back to all articles
How we work

Every step checked before it reaches you.

Menus move, settings get renamed and features quietly disappear. So each guide is written against the vendor's current documentation rather than from memory, and says plainly when a fix depends on your version.

3
Desks covered
0
Sponsored posts
$0
Cost to read
Every
Guide source-checked

One email when we publish a fix worth knowing.

No filler, and we do not pass your address to anyone.