How to Apply Custom Freeze Panes in Excel (3 Easy Ways)

In this article, we will demonstrate how to use custom freeze panes in Excel. We can easily lock the first row or column from the ‘Freeze Panes’ option directly, but here, we will use the ‘Freeze Panes’ option to lock any rows or columns we want.

Method 1 – Using Freeze Panes Feature to Freeze Custom Rows and Columns

We can freeze rows or columns in our Excel worksheet using the ‘Freeze Panes’ tool. To illustrate how, we will use the following dataset containing the sales amounts of some salesmen for the first six months of a year.

Custom Rows and Columns Freezing with Freeze Panes in Excel

Steps:

  • Decide which rows and columns to freeze. Here, we will lock Columns C and B, along with Rows 6 and 7.

Custom Rows and Columns Freezing with Freeze Panes in Excel

  • To freeze Columns C & B and Rows 6 & 7, select Cell D8.

Custom Rows and Columns Freezing with Freeze Panes in Excel

  • To lock columns and rows simultaneously, select a cell just below the row and just to the right of the column you want to freeze.
  • Go to the View tab and select Freeze Panes.

  • From the drop-down menu that opens, select Freeze Panes.

Custom Rows and Columns Freezing with Freeze Panes in Excel

A horizontal line and a vertical line appear in the worksheet like below.

Custom Rows and Columns Freezing with Freeze Panes in Excel

If we scroll down, Row 6 & 7 are locked.

Custom Rows and Columns Freezing with Freeze Panes in Excel

  • Similarly, if we scroll left to right, Columns C & B are also locked.

Custom Rows and Columns Freezing with Freeze Panes in Excel

  • To freeze any specific rows, select the row just below the rows you need to freeze, such as Row 9 here.

Custom Rows and Columns Freezing with Freeze Panes in Excel

  • Go to the View tab and select Freeze Panes as above.
  • Scroll down.

Rows 6, 7 & 8 are frozen.

Custom Rows and Columns Freezing with Freeze Panes in Excel

  • To freeze a column, just select the column next to it.

  • Use the previous steps to return results like below.

Read More: Excel Freeze Panes Not Working


Method 2 – Using the Magic Freeze Button

We can save time and energy freezing any rows or columns with a customized Quick Access Toolbar.

Steps:

  • Go to the ‘Customize Quick Access Toolbar’ icon in the upper left corner of the screen.

Customized Locking with Excel Magic Freeze Button

  • Select ‘More Commands’ from the drop-down menu.

Customized Locking with Excel Magic Freeze Button

  • Select ‘Freeze Panes’ from the ‘Choose commands from’.
  • Click ‘Add’ and then OK to include the button in the toolbar.

Customized Locking with Excel Magic Freeze Button

A new icon will appear in the Quick Access Toolbar, the Freeze Panes magic button.

Customized Locking with Excel Magic Freeze Button

  • Select Column C to lock Columns A & B.

Customized Locking with Excel Magic Freeze Button

  • Select the Freeze Panes icon and Freeze Panes from the drop-down menu that opens.

Customized Locking with Excel Magic Freeze Button

Columns A & B are frozen like below.

Customized Locking with Excel Magic Freeze Button

Read More: How to Freeze Multiple Panes in Excel 


Method 3 – Using Keyboard Shortcuts to Apply Custom Freeze Panes

The keyboard shortcut to freeze rows or columns is Alt + W + F + F.

Steps:

  • Select the column to the immediate right of the column we want to freeze. We select Column D here because we want to freeze Columns A, B & C.

Use of Keyboard Shortcuts to Custom Freeze Panes

  • Press the Alt key to reveal a ribbon like below.

Use of Keyboard Shortcuts to Custom Freeze Panes

  • Press W, which will open the View tab.

Use of Keyboard Shortcuts to Custom Freeze Panes

  • Press F. This will open the drop-down menu of Freeze Panes.

Use of Keyboard Shortcuts to Custom Freeze Panes

  • Again press F to freeze the desired columns.

Use of Keyboard Shortcuts to Custom Freeze Panes

Read More: Keyboard Shortcut to Freeze Panes in Excel


Freeze Rows & Columns with VBA in Excel

Excel VBA also gives us the opportunity to custom freeze rows, columns, and cells in our dataset.

Steps:

  • Go to the Developer tab and select Visual Basic.

Freeze Rows & Columns with VBA in Excel

  • Go to Insert and select Module.
  • Enter the following code in the Module and Save it:
Sub Lock_Row()
   ActiveWindow.FreezePanes = False
   Rows("8:8").Select
   ActiveWindow.FreezePanes = True
End Sub

Freeze Rows & Columns with VBA in Excel

Here, we want to lock the rows above Row 8, so we put “8:8” in the code.

  • Go to Macros on the Developer tab.

  • Select Run from the Macro window that opens.

  • Run the code.

The rows above Row 8 are frozen.

  • To freeze a specific column, enter the code below:
Sub Lock_Column()
   ActiveWindow.FreezePanes = False
   Columns("C:C").Select
   ActiveWindow.FreezePanes = True
End Sub

  • After running the code, Columns A & B are frozen.

  • To freeze rows and columns simultaneously, enter the code below:
Sub Lock_Cell()
   ActiveWindow.FreezePanes = False
   Range("D8").Select
   ActiveWindow.FreezePanes = True
End Sub

  • After running the code, Columns A, B & C and the rows above Row 8 will be frozen.


Things To Remember

  • You cannot lock columns or rows in the middle of your worksheet. You can only freeze rows above the selected row and columns on the left side of the worksheet.
  • The Freeze Panes command will not work when you are in editing mode. To cancel edit mode, press the Esc key.

Download Practice Book


Related Articles


<< Go Back to Freeze Panes | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mursalin Ibne Salehin
Mursalin Ibne Salehin

Mursalin Ibne Salehin holds a BSc in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. Over the past 2 years, he has actively contributed to the ExcelDemy project, where he authored over 150 articles. He has also led a team with content development works. Currently, he is working as a Reviewer in the ExcelDemy Project. He likes using and learning about Microsoft Office, especially Excel. He is interested in data analysis with Excel, machine learning,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo