MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Changing Window Size From Within Macro


Posted by Kadir on December 24, 2001 9:14 AM

I have a table, let's say, at a size of m rows and n colums. I want to change the size of the window so that only m rows and n colums are displayed. If possible switch of any toolbars, row/column indices etc, and lock the window so that it can not be changed by someone else.


Posted by Gary Bailey on December 24, 2001 12:22 PM

I think you'll find the ScrollArea property of the Worksheet useful. Using it you can stop the user from scrolling or selecting outside of a certain area.

You have to set it each time the worksheet's loaded though - it doesn't get saved.

Eg

activesheet.scrollarea=range("a1",cells(m,n)).Address

Will restrict scrolling on the current activesheet.

Gary