ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prevent PageDown (https://www.excelbanter.com/excel-programming/329958-prevent-pagedown.html)

OJ[_2_]

Prevent PageDown
 
Hi,
I've designed a sheet so that the unused columns and rows are hidden,
and the usuable area of the sheet is displayed completely in the
activewindow. It works ok but when a user presses PageDown (or
Shift+PageDown or Ctrl+PageDown) they are presented with an entirely
grey screen. How can I avoid this happening? I thought a
Selection_Change event but that does not fire, which in hindsight makes
sense. How can I ensure that the activewindow ALWAYS displays the
visible area?

OJ


Norman Jones

Prevent PageDown
 
Hi OJ,

You can set the worksheet's ScrollArea property to restrict navigation to
the requisite area, e.g.:

Sub Tester()
Dim ws As Worksheet

Set ws = ActiveSheet <<=== Change
ws.ScrollArea = "A1:F10" <<=== Change
End Sub

To remove the scroll restriction, set the scrollarea to the empty string
("").

---
Regards,
Norman



"OJ" wrote in message
oups.com...
Hi,
I've designed a sheet so that the unused columns and rows are hidden,
and the usuable area of the sheet is displayed completely in the
activewindow. It works ok but when a user presses PageDown (or
Shift+PageDown or Ctrl+PageDown) they are presented with an entirely
grey screen. How can I avoid this happening? I thought a
Selection_Change event but that does not fire, which in hindsight makes
sense. How can I ensure that the activewindow ALWAYS displays the
visible area?

OJ




arno

Prevent PageDown
 
Hi OJ,
It works ok but when a user presses PageDown


use ScrollArea, see VBA-help

arno

OJ[_2_]

Prevent PageDown
 
Thanks Norman......I was looking in the wrong place.



All times are GMT +1. The time now is 03:30 PM.

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