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

RogerC

Well-known Member
Joined
Mar 25, 2002
Messages
535
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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

RickXL

MrExcel MVP
Joined
Sep 9, 2013
Messages
4,328
Does this do what you want?

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    ActiveWindow.ScrollRow = Selection.Row
End Sub
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,319
Messages
5,836,607
Members
430,441
Latest member
SurendraTantia

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
Top