Freeze Excel headers while you scroll

Anonymous
2024-12-11T16:50:07+00:00

I have a very long spreadsheet that uses multiple headers for different sections of a table. I want to make it so that as you scroll the most recent header freezes at the top of the screen. Then, as you scroll to the next section, it is replaced by the next header. This would make it so much easier to read as each section can get somewhat long. Is there a way to do this in excel?

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Anonymous
    2024-12-12T02:24:36+00:00

    Freeze Panes can only freeze one range in a single sheet, and there is no macro event that triggers when you scroll in Excel to reset the freeze range.

    The only way to achieve your goal is to use the SelectionChange event to reset the freeze range and hide the previous row. You can hard code the header for each section and run the hide rows action and freeze pane action using a macro, which is triggered by the SelectionChange event.

    Worksheet.SelectionChange event (Excel) | Microsoft Learn

    Could you share a test file with some dummy data in it? Then I can have a try on it.

    For sharing file, you may upload it to OneDrive or any other cloud drive and then post the link here.  *Please make sure you have removed any sensitive or private information in the sample file before uploading.

    0 comments No comments
  2. Anonymous
    2024-12-17T17:26:07+00:00

    Thank you for your reply. Here is a link to a test file with some dummy data. RB_test.xlsx

    0 comments No comments
  3. Anonymous
    2024-12-18T05:56:26+00:00

    From your test file, just need freeze top 3 rows since all the headings are the same.

    What you want to do next after freezing headings or is there any other action which will use these heading rows?

    0 comments No comments
  4. Anonymous
    2024-12-18T13:39:36+00:00

    The heading titles are actually different in the file. I originally changed them just to indicate that they need to be frozen. Some of the headings may repeat but we simply did that to account for not being able to see the heading and column description when scrolling through a longer section of the list. If you scroll down farther, you'll see that the "shoulder out dim." column changes to the "flange series" column.

    0 comments No comments
  5. Anonymous
    2024-12-23T06:52:27+00:00

    I have tried with macro, but I cannot make it work while you are using scoll instead of mouse click.

    Hope other member in this community can give more suggestions on it.

    0 comments No comments