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

RogerC

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

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

RickXL

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

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

Watch MrExcel Video

Forum statistics

Threads
1,122,518
Messages
5,596,630
Members
414,082
Latest member
sasmita

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