How to Lock Rows in Excel (Step-by-Step Guide)
Written by the team at Iron Software
Locking rows in Excel means using the freeze panes feature to keep one or more rows permanently visible on screen as you scroll down through a large data set. The moment you apply it, the selected rows stay pinned at the top of the worksheet while the rest of the sheet scrolls freely beneath them. This is especially useful for keeping column headers or important headers in view when working with dozens or even hundreds of rows.
The good news is that Excel makes this remarkably easy. Whether you want to freeze top row to keep a single header visible, lock multiple rows at once, or even freeze both rows and columns simultaneously, there is a dedicated option for each scenario. The freeze feature in Excel enhances workflow by keeping header rows visible, facilitating data comparison, and preventing navigation errors in large data sets.
In this guide, you will learn how to lock rows using the view tab ribbon method, the freeze top row shortcut, the freeze multiple rows approach, how to freeze rows and columns together, and how to unfreeze rows when you no longer need them. At the end, developers will find a section on how IronXL handles freeze panes programmatically in .NET applications.
Method 1: Freeze the Top Row (One-Click Solution)
The fastest way to lock a header in Excel is the freeze top row option. This is a true one click operation and requires no cell selection beforehand. Freezing the top row in Excel can be done quickly by selecting Freeze Top Row from the View tab, which keeps the header visible while scrolling.
Steps:
- Open your spreadsheet in Excel.
- Select view by clicking the View tab in the ribbon at the top of the window.
- Click the freeze panes button in the Window group.
- From the drop-down menu, choose Freeze Top Row.
Excel immediately locks row 1. A slightly thicker border line appears beneath it, confirming the freeze is active. Now scroll down through your data and the top row remains fixed at the top of the screen.
This option only locks row 1. If your headers are on a different row, use Method 2 instead.

Method 2: Freeze Multiple Rows
When your headers span more than one row, or when you need to lock the first three rows of a report, you use this method. To freeze multiple rows in Excel, select the cell below the last row you want to freeze and then click on Freeze Panes in the View tab.
For example, to lock your first two columns of row data plus a title banner, or to pin the first three rows of a sales table, follow these steps:
Steps:
- Click on the single cell in column A that sits directly below the last row you want to lock. To lock the first three rows, for instance, click cell A4.
- Go to the view tab in the ribbon.
- Click click freeze panes from the freeze panes button drop-down.
- Select freeze panes from the options that appear.
Excel locks all rows above your selected cell. There is no limit to the number of rows you can freeze in Excel; you can freeze any number of rows by selecting the appropriate cell below the last row you want to keep visible.
To freeze the first two rows, click cell A3. To freeze four rows, click cell A5. The rule is simple: always click one row below the last row you want frozen.

Method 3: Freeze the First Column
Sometimes the key column you need to keep visible is on the left rather than the top. When you freeze the first column in Excel, it remains visible while you scroll horizontally through your data, allowing you to keep track of row labels.
Steps:
- Click anywhere on your sheet. No specific selected cell is required.
- Open the view tab in the ribbon.
- Click the freeze panes button.
- Choose Freeze First Column from the menu.
The column frozen line appears to the right of columns a b (column A in this case), confirming the first column is now locked. This is particularly useful in data sets with many multiple columns where the row identifier sits in column A.

Method 4: Freeze Multiple Columns
When you need more than one column locked, the process is similar to freeze multiple rows. To freeze multiple columns in Excel, select the column immediately to the right of the last column you want to freeze, then go to the view tab and click on freeze panes.
For example, to lock columns a b together:
Steps:
- Click the header of the column immediately to the right of the last column you want to lock. To freeze columns A and B, click on column C (or any cell in that column).
- Go to the view tab.
- Click freeze panes and select freeze panes.
The column border appears after column B, and both columns a b remain visible as you scroll to the right. Keeping column labels visible while scrolling helps prevent errors during data entry in Excel.

Method 5: Freeze Rows and Columns Simultaneously
This is the most powerful freeze setup, ideal for large data sets where both the column headers (top row) and row identifiers (left column) need to stay on screen at all times. To freeze both rows and columns simultaneously in Excel, select the cell that is below the rows and to the right of the columns you want to freeze, then choose freeze panes from the view tab.
Steps:
- Click the selected cell at the intersection point. For example, if you want to lock row 1 and the first column, click cell B2. For specific rows and first two columns, click cell C3.
- Navigate to the view tab in the ribbon.
- Click the freeze panes button and select freeze panes.
Excel freezes everything above and to the left of your selected cell. Freezing rows and columns in Excel helps maintain context when navigating large datasets, making data entry and analysis more efficient.
A helpful trick: think of your selected cell as the "moving corner." Everything above it and to the left of it will freeze. Everything below and to the right will scroll.

Method 6: Using Split Panes
Split panes is a related but different feature. While freeze panes locks rows or columns to the edge of the window, split divides the worksheet into separate scrollable panes that each scroll independently. You use click split from the view tab to activate it.
When to use split vs freeze:
- Use freeze when you want important headers or labels always visible at the top or left.
- Use split panes (via click split) when you want to compare specific areas of the same worksheet side by side, for instance comparing the last row of a data range with the first rows.

How to Unfreeze Rows and Columns
Once you no longer need the freeze, removing it takes just a few clicks. To unfreeze rows or columns in Excel, go to the view tab and select unfreeze panes from the freeze panes menu.
Steps:
- Go to the view tab in the ribbon.
- Click freeze panes.
- Choose select unfreeze panes from the drop-down.
When you unfreeze panes in Excel, it removes all frozen rows and columns at once; you cannot selectively unfreeze only rows or only columns. If you need to change which rows or columns are frozen after unfreezing, simply select the appropriate cell and apply freeze panes again.

Common Issues and Troubleshooting
Freeze Panes option is greyed out
The Freeze Panes option is unavailable if the sheet is in cell editing mode or protected. Click somewhere outside the active cell first, or check if the worksheet is password-protected under the Format Cells or Review tab settings. Check the format cells dialog if the protection feature seems to be blocking access.
The wrong rows are freezing
This usually means the selected cell was not in the right position before clicking freeze panes. Remember the rule: the freeze happens above and to the left of the cell you clicked. Delete the freeze using unfreeze panes and reapply with the correct cell selected.
Freeze line not visible
On some screen resolutions or zoom layout settings the freeze border can appear very faint. Try zooming into the sheet to 100% using the view tab zoom controls. The line should become clearly visible.
Cannot freeze a row in the middle of the data set
Excel only allows freezing rows at the top of the spreadsheet, not in the middle of a data range. If you want specific rows from the middle of your data to appear fixed, consider duplicating that region into the top row area or using split panes instead.
The freeze panes button is missing from the ribbon
Make sure you are on the View tab and that tab is not minimised. On smaller window sizes the ribbon can collapse groups. Click the group label to expand it, or try resizing the Excel window to full screen.
Frozen rows behave differently after applying a filter
When you apply a filter to a table, the filter arrows appear in row 1. If you have frozen row 1, the filter drop-downs will remain visible as you scroll, which is usually the intended answer. The freeze feature works similarly in other spreadsheet applications like Google Sheets, LibreOffice Calc, and Apache OpenOffice Calc, so this same approach applies across those tools.
Values not updating in frozen rows
The freeze only affects what rows stay visible while scrolling. It has no effect on values or formatting. If values in the frozen row look wrong, it is a formula or data issue, not a freeze issue. Check format cells to confirm the number formatting is correct. By default, Excel does not lock all the cells in the header row against editing; it only keeps them visually pinned. This is a common source of confusion for users exploring the ranges of what the freeze option does and does not do. It is purely a navigation aid and carries no key information about cell protection.
Quick Reference Table
| Goal | Step | Key Setting |
|---|---|---|
| Freeze top row | View tab > Freeze Panes | Freeze Top Row |
| Freeze multiple rows | Select cell below last row | Freeze Panes |
| Freeze first column | View tab > Freeze Panes | Freeze First Column |
| Freezing columns (multiple) | Select column to right | Freeze Panes |
| Freeze rows and columns | Select intersection cell | Freeze Panes |
| Unfreeze rows | View tab > Freeze Panes | Unfreeze Panes |
| Split panes | View tab | Split |
Freezing panes allows users to view important headers and labels at all times, which enhances the overall presentation of data in Excel spreadsheets. By freezing the top row, users can keep column headers visible while scrolling through extensive data, which prevents confusion about data categories.
For Developers: Freeze Rows in .NET with IronXL
If you are a .NET or C# developer generating Excel reports, dashboards, or exports programmatically, IronXL lets you apply freeze panes directly in code so your end users receive files with rows and columns already locked. No manual steps required on the user's end.
IronXL's CreateFreezePane(colSplit, rowSplit) method takes two parameters: the number of columns to freeze from the left, and the number of rows to freeze from the top. To freeze just the header row, pass (0, 1). To freeze both the header row and the first column, pass (1, 1).
Install IronXL
Install-Package IronXL.Excel
Install-Package IronXL.Excel
Code Example: Freeze Top Row and First Column
using IronXL;
// Load or create an Excel workbook
WorkBook workBook = WorkBook.Load("sales_report.xlsx");
WorkSheet workSheet = workBook.WorkSheets.First();
// Freeze the top row (row 1) only
workSheet.CreateFreezePane(0, 1);
// To freeze both the header row and the first column:
// workSheet.CreateFreezePane(1, 1);
// To freeze the first three rows and two columns simultaneously:
// workSheet.CreateFreezePane(2, 3);
// Save the file with freeze panes applied
workBook.SaveAs("sales_report_frozen.xlsx");
using IronXL;
// Load or create an Excel workbook
WorkBook workBook = WorkBook.Load("sales_report.xlsx");
WorkSheet workSheet = workBook.WorkSheets.First();
// Freeze the top row (row 1) only
workSheet.CreateFreezePane(0, 1);
// To freeze both the header row and the first column:
// workSheet.CreateFreezePane(1, 1);
// To freeze the first three rows and two columns simultaneously:
// workSheet.CreateFreezePane(2, 3);
// Save the file with freeze panes applied
workBook.SaveAs("sales_report_frozen.xlsx");
Imports IronXL
' Load or create an Excel workbook
Dim workBook As WorkBook = WorkBook.Load("sales_report.xlsx")
Dim workSheet As WorkSheet = workBook.WorkSheets.First()
' Freeze the top row (row 1) only
workSheet.CreateFreezePane(0, 1)
' To freeze both the header row and the first column:
' workSheet.CreateFreezePane(1, 1)
' To freeze the first three rows and two columns simultaneously:
' workSheet.CreateFreezePane(2, 3)
' Save the file with freeze panes applied
workBook.SaveAs("sales_report_frozen.xlsx")
The resulting file opens in Excel with the freeze already applied. This is especially helpful when distributing reports to non-technical stakeholders. The RemovePane() method is available to clear all freeze settings when needed.
IronXL also handles data reading, writing, format cells, formulas, charts, password protection, and file format conversion between XLSX, XLS, CSV, and more. You can explore the full IronXL freeze panes documentation for advanced usage including four-parameter overloads that set custom scroll starting points.
Start with a free trial to try IronXL in your projects without any upfront commitment.
Further Reading:
Wrapping Up
Knowing which freeze method to reach for makes a real difference when working through a long data set. If you only need to lock a top row header, the one click Freeze Top Row option from the view tab gets it done instantly. When your layout requires locking specific rows, freezing columns, or pinning both at once, selecting the right selected cell before you click freeze panes is the key to getting the result you want. Removing the freeze is just as simple: go to the view tab, open the freeze panes drop-down, and select unfreeze panes.
For developers building .NET applications that generate Excel files, IronXL removes the need for end users to configure any of this manually. One call to CreateFreezePane() and the freeze settings are baked into the file before it ever reaches the user. Grab a free trial and see how much time it saves.




