Freeze Panes in Excel

The code example above shows how to create 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 compare information.

CreateFreezePane(column, row)

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

CreateFreezePane(column, row, subsequentColumn, subsequentRow)

This overload create freeze pane based on the column and row amount provided as well as apply scrolling to the worksheet. For example, workSheet.CreateFreezePane(5, 2, 6, 7) will have freeze pane from column(A-E) and row(1-2) with 1 column and 5 row scroll. When the worksheet is first open it will show column A-E,G-... and the row 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 file project from this link.

Navigate to the "Freeze Panes" How-To article for more information and demonstrations.