J
Joerg
Hello world,
I have created a macro that scrolls all sheets of a workbook to the top left
corner (A1). Works as expected, however if the window of a sheet is set to
'Freeze panes', it doesn't.
I can see that Excel has a point: The top left cell is always visible when
panes are frozen, but I want the inner 'unfrozen' part to align to top left
as well. If I could determine the frozen area then I could handle these
cases by unfreezing - scrolling - refreezing, but I can't find a property
that would indicate the frozen range.
Example: If I activate B2, then do a Window => Freeze panes, then activate
the last cell in column B (B65536), the window shows A1 in the top left
corner, followed by A65503. I would like to show it A1, followed by A2. How
can I do it?
Here is the macro:
Sub ScrollToTopLeftCorner()
ActName = ActiveSheet.Name
For Each ws In Sheets
ws.Activate
ActiveWindow.ScrollIntoView 0, 0, 0, 0
Next
Sheets(ActName).Activate
End Sub
Thanks,
Joerg
I have created a macro that scrolls all sheets of a workbook to the top left
corner (A1). Works as expected, however if the window of a sheet is set to
'Freeze panes', it doesn't.
I can see that Excel has a point: The top left cell is always visible when
panes are frozen, but I want the inner 'unfrozen' part to align to top left
as well. If I could determine the frozen area then I could handle these
cases by unfreezing - scrolling - refreezing, but I can't find a property
that would indicate the frozen range.
Example: If I activate B2, then do a Window => Freeze panes, then activate
the last cell in column B (B65536), the window shows A1 in the top left
corner, followed by A65503. I would like to show it A1, followed by A2. How
can I do it?
Here is the macro:
Sub ScrollToTopLeftCorner()
ActName = ActiveSheet.Name
For Each ws In Sheets
ws.Activate
ActiveWindow.ScrollIntoView 0, 0, 0, 0
Next
Sheets(ActName).Activate
End Sub
Thanks,
Joerg