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!

The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

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!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Fernando · 2 months ago
    Is it possible to do it on selected worksheets only?

    what would i need to change in the code.
    • To post as a guest, your comment is unpublished.
      skyyang · 1 months ago
      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!
      • To post as a guest, your comment is unpublished.
        Fernando · 1 months ago
        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?
  • To post as a guest, your comment is unpublished.
    JD · 4 years ago
    want to be able to freeze top row on multiple worksheets
  • To post as a guest, your comment is unpublished.
    Kurt · 5 years ago
    I tried this in my workbook and it worked very well.

    thanks
  • To post as a guest, your comment is unpublished.
    Orchid · 6 years ago
    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