Scroll down a long sheet and the header row disappears. A few hundred rows in, you're no longer sure which column is which, so you scroll back up, check, and scroll down again. Scroll sideways and the names vanish too, and you lose track of whose row you're reading.
Freeze Panes keeps those rows and columns on screen.
TL;DR: View > Freeze Panes > Freeze Top Row. To also lock the name columns, select the cell just right of them and below the header, then use the Freeze Panes option for your selection.
Steps
- Go to the View tab, open Freeze Panes, and choose Freeze Top Row.
- Scroll down. The header row stays at the top.
- To keep the header and the first columns visible together, select the cell just below the header and just right of the columns you want to keep. In the example sheet, with a number in column A and a name in column B, that's C2. Then choose the Freeze Panes option that freezes based on your selection.
Now you can scroll down and sideways, and the header row and the number and name columns stay in view. Moving across the sheet, you can always see whose row you're on.
To undo it, open the same menu and choose Unfreeze Panes.
Checked in the free Excel for the web.
How the selection works
Excel freezes everything above and to the left of the selected cell. Selecting C2 keeps row 1 and columns A and B fixed. Selecting B2 would keep row 1 and column A only. Picking the cell is the only part that needs any thought.
Common mistakes
- Selecting the wrong cell. If too much or too little stays frozen, unfreeze, pick a different cell and try again.
- Freezing while scrolled down. Rows above the visible area can end up frozen out of view. Scroll to the top before freezing.
- Expecting it to affect printing. Freeze Panes only changes the screen. Repeating header rows on printed pages is a separate print setting.
Setting it from code
If you generate workbooks for other people, freezing the header before sending them is a small courtesy. In openpyxl it's one line, and it uses the same top-left-cell rule as the ribbon:
ws.freeze_panes = "A2" # freeze the top row
ws.freeze_panes = "C2" # freeze row 1 and columns A:B
AI-assisted write-up, checked against the original steps in Excel for the web.
Top comments (0)