Data Tools · VBA

Freeze Headers on All Sheets

Freeze the top row on every worksheet at once.

download.bas (ES) download.bas (EN)
' Freezes the top row on every worksheet at once.
Sub FreezeHeaderAllSheets()
    Dim ws As Worksheet
    For Each ws In ThisWorkbook.Worksheets
        ws.Activate
        ws.Range("A2").Select
        ActiveWindow.FreezePanes = True
    Next ws
    ThisWorkbook.Worksheets(1).Activate
End Sub

Free to use and modify · ExcelBot — excelempowers.com

Loops through all worksheets and freezes the header row (row 1) on each.

How to install:

  1. Open your workbook and press Alt + F11 to open the VBA editor.
  2. Choose Insert ▸ Module and paste the code (or File ▸ Import File for the .bas).
  3. Press F5 to run, or run it from Developer ▸ Macros.
  4. Save your file as .xlsm (macro-enabled) to keep the macro.

No VBA? In ExcelBot you can do the same thing by just asking the AI in plain language.

freeze panes headers all sheets congelar encabezados
Rather not use VBA?

In ExcelBot you get the same result by asking the AI in plain language — no macros needed.

Try ExcelBot free Browse more macros

Related macros