How to Apply Freeze/Unfreeze Panes to Multiple Excel Worksheets at Once?


Applying freeze is only possible for one row at a time in a column, but have you ever tried to apply freeze or unfreeze panes to multiple worksheets at once? This can only be done using the VBA in Excel. Read this tutorial to learn how you can apply freeze or unfreeze panes to multiple Excel worksheets at once.

Applying Freeze Panes to Multiple Excel Worksheets at Once

Here we will first insert a VBA module and then run the code to freeze the cells. Let's see a simple process to understand how we can apply freeze panes to multiple worksheets at once in Excel.

Step 1

Let us consider a new Excel sheet, then right-click on the sheet name and select view code to open the VBA application, then click on insert, select module, and type the programme into the text box as shown in the below image.

Program

Sub Freeze()
'Updateby Nirmal
Dim Ws As Worksheet
Application.ScreenUpdating = False
For Each Ws In Application.ActiveWorkbook.Worksheets
   Ws.Activate
   With Application.ActiveWindow
      .FreezePanes = True
   End With
Next
Application.ScreenUpdating = True
End Sub

Step 2

Now click on F5 to run the VBA code, and multiple cells will be frozen as shown in the below image.

Applying Unfreeze Panes to Multiple Excel Worksheets at Once

Here we will first insert a VBA module and then run the code to unfreeze the cells. Let's see a simple process to understand how we can apply unfreeze panes to multiple worksheets at once in Excel.

Step 1

Let us consider a new Excel sheet, then right-click on the sheet name and select view code to open the VBA application, then click on insert, select module, and type the programme into the text box as shown in the below image.

Program

Sub UnFreeze()
'Updateby Nirmal
Dim Ws As Worksheet
Application.ScreenUpdating = False
For Each Ws In Application.ActiveWorkbook.Worksheets
   Ws.Activate
   With Application.ActiveWindow
      .FreezePanes = False
   End With
Next
Application.ScreenUpdating = True
End Sub

Step 2

Now save the spreadsheet as VBA enabled and close it; the next time you open it, click on enable code to finish our process. 

Conclusion

In this tutorial, we used a simple example to demonstrate how we can apply freeze and unfreeze to multiple sheets in Excel to highlight a particular set of data.

Updated on: 03-Jan-2023

458 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements