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.