To lock the header row in Excel so it stays visible while you scroll, select View > Freeze Panes > Freeze Top Row; to lock several rows, select the row below them and choose Freeze Panes instead.
This guide covers six methods: freezing the top row, freezing multiple rows, split panes, grouped rows, VBA, and sheet protection that stops locked rows from being edited.

Method 1: Using the Freeze Top Row feature
Freeze Top Row keeps row 1 on screen however far down you scroll. It works in Excel for Microsoft 365, Excel 2024, 2021, 2019, 2016 and Excel for the web.
- Open the worksheet and scroll to the top so row 1 is the first visible row.
- Select the View tab on the ribbon.
- Select Freeze Panes > Freeze Top Row.
- Scroll down. Row 1 stays fixed, and a slightly darker border appears under it.
Understanding the concept of locking rows in Excel
"Lock rows" means two different things in Excel: keeping rows visible while you scroll, or stopping people from changing them. Each tool below does one job only.
| Tool | What it locks | What it does not do |
|---|---|---|
| Freeze Panes / Freeze Top Row | Position: rows above the selected cell stay on screen | Does not stop anyone typing in those rows |
| Split | Two independently scrolling panes of the same sheet | Both panes can still scroll, so nothing is truly fixed |
| Group (outline) | Rows collapse behind a minus button and expand on demand | Collapsed rows are hidden, not protected |
VBA (FreezePanes, ScrollArea) |
Freeze position set by code, or a scroll area people cannot leave | Anyone who can run macros can undo it |
| Protect Sheet | Content: locked cells cannot be edited | Does not keep rows visible while scrolling |
Why lock rows in Excel?
| Your situation | Use this | Why |
|---|---|---|
| A single header row must stay visible | Method 1: Freeze Top Row | One click, no cell selection needed |
| A title block plus a header row, rows 1 to 3 | Method 2: Freeze Panes on row 4 | Freezes every row above the selection |
| Compare row 5 with row 180 side by side | Method 3: Split | Each pane scrolls on its own |
| Detail rows clutter a summary | Method 4: Group rows | Collapse and expand sections with one button |
| The same freeze must apply on every sheet or file | Method 5: VBA | A macro repeats the setup exactly |
| Colleagues keep overwriting headers or formulas | Method 6: Protect Sheet | Locked cells refuse edits until the sheet is unprotected |
Method 2: Freezing multiple rows
Freeze Panes locks every row above the selected cell and every column to its left. The frozen block always starts at row 1, so select the first row you want to scroll.
- If anything is already frozen, select View > Freeze Panes > Unfreeze Panes first.
- Select the row directly below the last row to lock. To lock rows 1 to 3, select row 4 by clicking its row number.
- Select View > Freeze Panes > Freeze Panes.
- To lock rows and columns together, select the cell below the rows and to the right of the columns instead. Cell B2 locks row 1 and column A; D5 locks rows 1 to 4 and columns A to C.
- Scroll down and right to check the thicker border below the last frozen row.

Method 3: Lock rows using split panes (alternative technique)
Split divides the window into panes that scroll separately. Use it when the rows you want to keep in view are not at the top of the sheet.
- Select the row below where you want the split. Selecting row 13 splits the sheet below row 12.
- Select View > Window > Split.
- Scroll the lower pane to the rows you want to compare; the upper pane keeps its own position.
- To split rows and columns at once, select a cell instead of a whole row, such as D5, before selecting Split.
- Select View > Window > Split again to remove the split.

Freezing from the split view (alternative for custom locking)
A split can be turned into a freeze, which locks the upper pane in place. This gives a custom freeze line chosen by dragging rather than by selecting a cell.
- Create the split with View > Window > Split.
- Drag the horizontal split bar until the rows you want locked sit above it.
- Scroll the upper pane so its first visible row is the first row to lock.
- Select View > Freeze Panes > Freeze Panes. The split bar becomes a fixed frozen line.
- To undo, select View > Freeze Panes > Unfreeze Panes.
In VBA, ActiveWindow.FreezePanes = True freezes existing split panes in the same way.
Method 4: Use grouping and outline for collapsible rows
Grouping does not freeze rows; it folds detail rows away so the rows that matter stay together on screen.
- Select the detail rows to fold, for example rows 3 to 12, by dragging over their row numbers.
- On the Data tab, in the Outline group, select Group. If Excel asks, choose Rows and select OK.
- Select the minus button beside the row numbers to collapse the group, and the plus button to expand it.
- Select the level numbers 1 or 2 at the top of the outline bar to collapse or expand every group at once.
- Press Ctrl + 8 if the outline symbols are not showing.
- To remove the group, select the same rows and select Data > Ungroup.
For grouped totals built automatically, Data > Subtotal outlines the list and adds summary rows. Subtotal does not work inside an Excel table; convert the table to a range first.

Method 5: Using VBA for advanced locking
A macro applies the same freeze line to any sheet and can confine scrolling to a range. Press Alt + F11 to open the Visual Basic editor, select Insert > Module, paste the code and press F5 to run it.
Change SplitRow = 2 to the number of rows to lock and the ScrollArea range to the block people may use. Save the file as a macro-enabled workbook (.xlsm) to keep the code.
Sub LockHeaderRows()
With ActiveWindow
.FreezePanes = False
.SplitColumn = 0
.SplitRow = 2
.FreezePanes = True
End With
ActiveSheet.ScrollArea = "A1:F200"
End Sub
Sub ClearScrollArea()
ActiveSheet.ScrollArea = ""
End Sub
SplitRow sets how many rows sit above the split, and FreezePanes = True freezes that split. ScrollArea limits selection to A1:F200; cells outside it cannot be selected. ClearScrollArea sets it to an empty string, which restores the whole sheet.
You should see: Rows 1 and 2 stay fixed while you scroll, and clicking outside A1:F200 does nothing.
Lock rows using Windows scroll lock (via VBA for advanced users)
The Scroll Lock key does not freeze or protect rows. It changes what the arrow keys do, which is why it is often mistaken for a row lock.
| Question | Answer |
|---|---|
| What does Scroll Lock do in Excel? | With it on, the arrow keys scroll the sheet instead of moving between cells |
| How do I see if it is on? | Scroll Lock appears in the Excel status bar; right-click the status bar and tick Scroll Lock if the indicator is hidden |
| How do I turn it off? | Press ScrLk, or open the On-Screen Keyboard from Settings > Accessibility > Keyboard in Windows 11 and select ScrLk |
| Which VBA setting really keeps people in certain rows? | ActiveSheet.ScrollArea = "A1:F200" from Method 5; cells outside the range cannot be selected |
| Which setting keeps header rows on screen? | Freeze Panes, by hand (Methods 1 and 2) or with ActiveWindow.FreezePanes = True |
If the arrow keys suddenly move the whole sheet, turn off Scroll Lock in Excel before trying any freeze option.
Method 6: Protect the worksheet to prevent changes in locked rows
Every cell is marked Locked by default, but the setting only takes effect once the sheet is protected. To lock only certain rows, unlock everything first, then lock those rows.
- Select Select All (the triangle above row 1), press Ctrl + 1, open the Protection tab, clear Locked and select OK.
- Select the row numbers of the rows to lock, for example rows 1 to 3.
- Press Ctrl + 1 again, tick Locked on the Protection tab and select OK.
- Select Review > Protect Sheet.
- In Allow all users of this worksheet to, tick only what others may do, such as Select unlocked cells, Insert rows or Sort.
- Type a password in Password to unprotect sheet if you want one, select OK and retype it to confirm.
- Try typing in a locked row. Excel refuses the edit and shows a protection message.
Sheet protection stops accidental edits but is not a security feature. Keep the password safe, because a lost password locks you out of the protected cells too. For formula-only locks and Allow Edit Ranges, lock individual cells in Excel with the same Format Cells setting.

How to unfreeze rows in Excel
- Select the View tab.
- Select Freeze Panes > Unfreeze Panes to release frozen rows and columns.
- Select Split again on the View tab if a split is active.
- Select Review > Unprotect Sheet and enter the password to remove sheet protection.
How to repeat header rows when printing in Excel
Frozen rows only affect the screen. To print header rows at the top of every page, set print titles.
- Select Page Layout > Print Titles in the Page Setup group.
- On the Sheet tab, click in Rows to repeat at top.
- Type
$1:$1for row 1, or$1:$3for rows 1 to 3. - Select OK and check the result in print preview.

How to freeze rows in Excel on Mac, iPad and the web
| Platform | Freeze the top row | Freeze several rows |
|---|---|---|
| Excel for Windows | View > Freeze Panes > Freeze Top Row | Select the row below, then View > Freeze Panes > Freeze Panes |
| Excel for Mac | View > Freeze Top Row | Select the row below, then View > Freeze Panes |
| Excel for the web | View > Freeze Panes > Freeze Top Row | Select the row below, then View > Freeze Panes > Freeze Panes |
| Excel on iPad | View > Freeze Panes, then the top-row option | Select the row below, then View > Freeze Panes > Freeze Panes |
| Excel on iPhone | Tap …, then Home > View > Freeze Panes | Select the row below first, then the same path |

Practical tips for locking rows in Excel
| Tip | Why it helps |
|---|---|
| Scroll to the top before freezing | Freeze Panes locks the rows visible above the selection, not hidden ones |
| Unfreeze before choosing a new freeze line | Changing the selection does not move an existing freeze |
| Combine freeze and protection for shared files | Headers stay visible and cannot be overwritten |
| Tick Insert rows when protecting a data list | People can add rows without unprotecting the sheet |
| Protect Delete rows together with Insert rows | If only deletion is blocked, users can insert rows they cannot delete |
| Set print titles separately | Frozen rows do not repeat on printed pages |
| Keep freezes short on laptops | A tall frozen block leaves little room for the scrolling area |
How to tell if rows are frozen in Excel
- Look for a slightly thicker border under the last frozen row.
- Scroll down with the mouse wheel; frozen rows stay put while the rest moves.
- For protection, open the Review tab. Unprotect Sheet in place of Protect Sheet means the sheet is protected.
Common troubleshooting: Excel freeze panes not working
Freeze Panes is greyed out
The sheet is not in Normal view.
- Select View > Normal.
- Select Freeze Panes again.
The wrong rows are frozen
The selection or scroll position was off when the freeze was applied.
- Select View > Freeze Panes > Unfreeze Panes.
- Scroll to the top of the sheet.
- Select the row directly below the last row to lock and choose Freeze Panes again.
There is no View tab or Freeze Panes button
Excel Starter does not support every feature.
- Open the file in a full Excel edition or in Excel for the web.
- Select View > Freeze Panes there.
Arrow keys move the whole sheet instead of the cell
Scroll Lock is on.
- Check the status bar for Scroll Lock.
- Press ScrLk, or use the On-Screen Keyboard's ScrLk key.
Cells outside a range cannot be selected
A VBA ScrollArea is set on the sheet.
- Press Alt + F11 and run the
ClearScrollAreamacro from Method 5. - Or ask the file owner to remove the macro that sets the scroll area.
Locked rows can still be edited
The sheet is not protected, or those cells had Locked cleared.
- Select the rows, press Ctrl + 1 and tick Locked on the Protection tab.
- Select Review > Protect Sheet and select OK.
How to lock rows in Excel FAQ
How do I lock a row in Excel so it doesn't move when scrolling?
Select View > Freeze Panes > Freeze Top Row to keep row 1 fixed. For any other set of top rows, select the row just below them and choose View > Freeze Panes > Freeze Panes. The rows above the selection stay on screen.
How do I freeze the top 3 rows in Excel?
Scroll to the top, select row 4 by clicking its row number, then select View > Freeze Panes > Freeze Panes. Rows 1 to 3 stay visible, and a thicker border appears under row 3.
How do I freeze rows and columns at the same time?
Select the cell below the rows and to the right of the columns you want fixed, then choose View > Freeze Panes > Freeze Panes. Cell B2 freezes row 1 and column A; D5 freezes rows 1 to 4 and columns A to C.
Can I freeze a row in the middle of a sheet?
No. A freeze always starts at the top row and first column. To keep a middle section in view, use View > Window > Split, which gives two panes that scroll independently, or scroll that section to the top before freezing.
How do I lock rows in Excel so they cannot be edited?
Clear Locked for the whole sheet in Format Cells, tick Locked only for the rows to protect, then select Review > Protect Sheet. Excel blocks edits to those rows until someone unprotects the sheet, with the password if one was set.
Why is Freeze Panes greyed out in Excel?
Freeze Panes is unavailable outside Normal view. Select View > Normal, then try Freeze Panes again. If there is no View tab at all, the file is open in Excel Starter, which does not support every feature.
How do I unfreeze rows in Excel?
Select View > Freeze Panes > Unfreeze Panes. That removes every frozen row and column on the sheet at once. A split is removed separately by selecting View > Split again.
Do frozen rows repeat when printing?
No. Freezing only changes the screen. To print header rows on every page, select Page Layout > Print Titles and enter a range such as $1:$1 in Rows to repeat at top on the Sheet tab.

![How to update your browser [all web browsers]](https://techdows.com/wp-content/uploads/2026/12/How-to-update-your-browser-all-web-browsers-1-600x338.jpg)

![How to add new mailbox in Outlook easily [2 simple methods]](https://techdows.com/wp-content/uploads/2026/12/How-to-add-new-mailbox-in-Outlook-easily-2-simple-methods-1-600x338.jpg)

