Prevent PageDown

  • Thread starter Thread starter OJ
  • Start date Start date
O

OJ

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
 
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
("").
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top