ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Scroll the window to the top - frozen rows (https://www.excelbanter.com/excel-programming/313715-re-scroll-window-top-frozen-rows.html)

Rob van Gelder[_4_]

Scroll the window to the top - frozen rows
 
After fooling around with this routine, I've discovered it wont always
select the correct cell.
If a frozen pane (say, the column heading) is row 4 instead of row 1 then
strange things happen.

This routine should do the trick:

Sub test()
With ActiveWindow.Panes(ActiveWindow.Panes.Count)
.SmallScroll Up:=Rows.Count, ToLeft:=Columns.Count
.VisibleRange(1).Select
End With
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Rob van Gelder" wrote in message
news:...
Sub test()
Dim i As Long, j As Long

i = ActiveWindow.SplitRow + 1
If i = 1 Then i = Selection.Row
j = ActiveWindow.SplitColumn + 1
If j = 1 Then j = Selection.Column
Cells(i, j).Select
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"MDW" wrote in message
...
Hey all,

I've got some code that marches down a bunch of cells (about 700 rows)
and
applies formatting and formulas. When it's done, I want it to jump back
up to
the top. I was able to simply say

ActiveWorksheet.Range("A1").Select

to do what I wanted.

However, I froze the first row because it contains column headers. Now I
can't get the window to go back to the top. I've tried

ActiveWindow.ScrollRow = 1
and
ActiveWindow.ScrollRow = 2 (Only the first row is frozen).

Neither of them work. Any ideas?
--
Hmm...they have the Internet on COMPUTERS now!







All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com