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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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,833
Messages
6,121,869
Members
449,054
Latest member
juliecooper255

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