Move active row to top of visible rows (auto-scroll based on active cell)

RogerC

Well-known Member
Joined
Mar 25, 2002
Messages
536
I need whatever row currently contains the active cell to always be in the top-most position of the visible data range in my spreadsheet (the first row visible under the horizontal freeze pane split).

Just for example, my spreadsheet is split and frozen at row 3. If I click into any cell in row 7, I would like the spreadsheet to automatically shift up so that row 7 appears directly under row 3 (with rows 4, 5, 6 hidden under the split). In other words, I need the active row to always position itself as the top row immediately under the upper pane of the horizontal split.

Can this be done with VBA?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Does this do what you want?

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    ActiveWindow.ScrollRow = Selection.Row
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,058
Latest member
oculus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top