limit the scroll of a worksheet

J

jackrobyn1

how do I limit the scroll area of a worksheet to only view the area:-
columns =a to P
and
rows = 1 to 63

i need this so the page doesnt scroll to an unused area of the worksheet.
 
T

Tom Hutchins

From an earlier reply to a similar question:

You can set the scrollarea to a fixed range. Since the scrollarea method
does not stick between sessions you will have to reset it each time you open
the workbook.

You may wish to place the code into a WorkBook_Open Sub in the ThisWorkbook
module of the workbook and specify which worksheet, if only one sheet is
required.
Adjust the sheetname and range to suit.

Private Sub WorkBook_Open()
Sheets("YourSheet").ScrollArea = "A1:p63"
End Sub

Or also in the Thisworkbook module to limit scrollarea on all sheets.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
With ActiveSheet
.ScrollArea = "A1:p63"
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch
 
J

jackrobyn1

Thanks!!! works a treat, great.

Tom Hutchins said:
From an earlier reply to a similar question:

You can set the scrollarea to a fixed range. Since the scrollarea method
does not stick between sessions you will have to reset it each time you open
the workbook.

You may wish to place the code into a WorkBook_Open Sub in the ThisWorkbook
module of the workbook and specify which worksheet, if only one sheet is
required.
Adjust the sheetname and range to suit.

Private Sub WorkBook_Open()
Sheets("YourSheet").ScrollArea = "A1:p63"
End Sub

Or also in the Thisworkbook module to limit scrollarea on all sheets.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
With ActiveSheet
.ScrollArea = "A1:p63"
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch
 

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

Top