ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Freezing panes and the top of the screen (https://www.excelbanter.com/excel-programming/351698-freezing-panes-top-screen.html)

[email protected]

Freezing panes and the top of the screen
 
I'm writing a VBA Macro that will move the first row of the selected
range to row 4 and scroll the other rows and could use a tip ...


Now,


I have a worksheet where the first three rows are frozen ...


I'd to attach two buttons that should work like named anchor tags work
in HTML ...


When I click on the first button the row numbers should look like


1
2
3
100


And when I click on the other button the row numbers should look like


1
2
3
165


The numbers 100 and 165 correspond to the first row of a named rang -
but a solution
referencing row numbers works great.


Any suggestions?


Thanks.


[email protected]

Freezing panes and the top of the screen
 
I thought I'd add that

Range("A1").Select
Application.Goto Reference:=Cells(165, 1)

Is close to what I need, it's just that sometimes it places row 165
under the frozen cells but other times it makes row 165 the last
visible row.

Might there be a solution that uses Goto and then scrolls into position
if row 165 is the last row?

Thanks again


Ken Johnson

Freezing panes and the top of the screen
 
Hi,
Try ActiveWindow.ScrollRow = 100

and ActiveWindow.ScrollRow = 165

Ken Johnson


[email protected]

Freezing panes and the top of the screen
 
Thanks Ken.

Perfect.


Ken Johnson

Freezing panes and the top of the screen
 
You're welcome.
Thanks for the feedback.
Ken Johnson



All times are GMT +1. The time now is 08:18 AM.

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