IRONSOFTWAREHOME
Freeze Panes in Excel
using IronXL;
using System.Linq;

WorkBook workBook = WorkBook.Load("sample.xls");
WorkSheet workSheet = workBook.WorkSheets.First();

// Create freeze pane from column(A-B) and row(1-3)
workSheet.CreateFreezePane(2, 3);

// Overwriting freeze or split pane to column(A-E) and row(1-5) as well as applying prescroll
// The column will show E,G,... and the row will show 5,8,...
workSheet.CreateFreezePane(5, 5, 6, 7);

workBook.SaveAs("createFreezePanes.xls");

// Remove all existing freeze or split pane
workSheet.RemovePane();
Imports IronXL
Imports System.Linq

Dim workBook As WorkBook = WorkBook.Load("sample.xls")
Dim workSheet As WorkSheet = workBook.WorkSheets.First()

' Create freeze pane from column(A-B) and row(1-3)
workSheet.CreateFreezePane(2, 3)

' Overwriting freeze or split pane to column(A-E) and row(1-5) as well as applying prescroll
' The column will show E,G,... and the row will show 5,8,...
workSheet.CreateFreezePane(5, 5, 6, 7)

workBook.SaveAs("createFreezePanes.xls")

' Remove all existing freeze or split pane
workSheet.RemovePane()
NuGet Download
PM > Install-Package IronXL.Excel
Freeze Panes in Excel

Freeze Panes in Excel

The code example above shows how to create a freeze pane, locking rows and columns in place, allowing them to remain visible while scrolling. It is a very useful feature to keep the header column or row in place while quickly comparing information.

CreateFreezePane(column, row)

The first CreateFreezePane method overload takes the column and row amount to create a freeze pane based on it. For example, workSheet.CreateFreezePane(1, 4) will create a freeze pane from column(A) and rows(1-4).

CreateFreezePane(column, row, subsequentColumn, subsequentRow)

This overload creates a freeze pane based on the column and row amount provided as well as applies scrolling to the worksheet. For example, workSheet.CreateFreezePane(5, 2, 6, 7) will have a freeze pane from columns(A-E) and rows(1-2) with 1 column and 5 row scroll. When the worksheet is first opened, it will show columns A-E, G-... and the rows will show 1-2, 8-...

If you have a large table of data in Excel, it can be useful to freeze rows or columns. This way you can keep rows or columns visible while scrolling through the rest of the worksheet.

You can download a project file from this link.

Learn How to Add Freeze Panes in Excel with C#
View on GitHub

Ready to Get Started?

Nuget Downloads 2,237,574Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required