Skip to main content

How to apply freeze / unfreeze panes to multiple worksheets at once?

Supposing you have a large workbook which contains hundreds of worksheets, and now you need to apply the Freeze Panes to freeze all of the worksheets at once. With Excel’s Freeze Panes function, you can just freeze only one worksheet at a time, is there a way to freeze or unfreeze all worksheets immediately at once in Excel?

Apply Freeze Panes to all worksheets at once with VBA code

Apply Unfreeze Panes to all worksheets at once with VBA code

Apply Freeze / Unfreeze Panes to all worksheets at once by one click with Kutools for Excel


You can use the following code to apply the Freeze Panes to all worksheets, please do with following steps:

1. If you want to freeze all worksheets in the same position, select a cell that you want to freeze in the worksheet, and then hold Shift key to select all sheet tabs.

2. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

3. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Freeze all worksheets at once in Excel

Sub Freeze()
'Updateby Extendoffice
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

4. And then press F5 key to run this code, and all the worksheets have been applied with the freeze panes in the same position.

Note: If all the worksheets are not selected and the active cells of each worksheet are located in different positions, the freeze panes will in the different places as the active cells on.


If there are multiple worksheets are applied with the freeze panes in your Excel, how could you unfreeze them at a time except unfreezing them one by one?

1. Launch your workbook which worksheets have been applied with the freeze panes.

2. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

3. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Unfreeze all worksheets at once in Excel

Sub UnFreeze()
'Updateby Extendoffice
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

4. And then press F5 key to run this code, and all the worksheets that applied with the freeze panes have been unfrozen at once.


If you are not familiar with the VBA codes, here is a powerful tool- Kutools for Excel, its Freeze panes multiple worksheets and Unfreeze panes multiple worksheets utilities can help you to freeze or unfreeze all worksheets of current workbook at once.

Note:To apply this Freeze panes multiple worksheets, firstly, you should download the Kutools for Excel, and then apply the feature quickly and easily.

After installing Kutools for Excel, please do as this:

1. Select a cell where you want to apply the freeze pane for all worksheets, in this case, I click cell B2, see screenshot:

doc freeze all sheets 1-1

2. Then click Kutools Plus > Worksheet > Freeze panes multiple worksheets, see screenshot:

3. And then all of your worksheets have been applied the freeze panes in the same position of cell B2.

Note: If you want to unfreeze them immediately, you just need to apply the Unfreeze panes multiple worksheets feature by clicking Kutools Plus> Worksheet > Unfreeze panes multiple worksheets.

Download and free trial Kutools for Excel Now !


Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial Now!

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Is it possible to do it on selected worksheets only?

what would i need to change in the code.
This comment was minimized by the moderator on the site
Hi, Fernando,

To apply the freeze pane to selected sheets, please use the following code:



Sub Freeze()

'Updateby Extendoffice

Dim Ws As Worksheet

Dim xArrName As Variant

Dim xS

xArrName = Array("Sheet2", "Sheet3") 'Change the sheet names to your need

Application.ScreenUpdating = False

For Each xS In xArrName

Set Ws = Worksheets(xS)

If Not Ws Is Nothing Then

Ws.Activate

With Application.ActiveWindow

.FreezePanes = True

End With

End If

Next

Application.ScreenUpdating = True

End Sub



Please try it, thank you!
This comment was minimized by the moderator on the site
This would work but i would need to change every time i try and run it in a different workbook.

Is it possible for the macro to be modified to the sheets i select in the main pane by clicking on one and pressing shift and selecting the other ones?
This comment was minimized by the moderator on the site
want to be able to freeze top row on multiple worksheets
This comment was minimized by the moderator on the site
I tried this in my workbook and it worked very well. thanks
This comment was minimized by the moderator on the site
dear all, I have a test in my workbook, have a good note that before you apply this macro, please move the mouse to the cell that you need to apply freeze pane in the sheet. it's really helpful. this info is what I am looking for. thank you very much Lan
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations