Stopping the scroll bar

  • Thread starter Thread starter triple_juicy
  • Start date Start date
T

triple_juicy

Hi all, this is my first time. I don't know if this is the right place
for this problem but here I go. I have created a template of an
invoice the size of an A4 and would like to stop the scroll bar moving
both horizantally and vertically in normal view just as if it was in
print view. Is that possible through VBA and if yes what is the code
that I would need to achieve such task.

Thanks in advance
 
Not too sure what you are after but you can remove the scrollbars with
<Tools - Options> and then in the View tab, at the bottom, you can
deselect them.

Another way is to drop the zoom to 25%, select the Z100 cell and then
use <Windows - Freeze Panes>, now select the A1 cell and put the zoom
factor back to whatever you wish, the scrolls are still there but
because the freeze pane is outside of the window then no amount of
movement of the scroll bars will change the screen picture.

:)
 
juicy

Look at the ScrollArea property. SOmething like

Sheets("mysheet").ScrollArea = "A1:G32"

This is volatile, so you have to set it each time the workbook is
opened. Put it in Workbook_Open in ThisWorkbook module or Auto_Open in
general module.

Gord Dibben Excel MVP
 
Check out the worksheet ScrollArea property in VBA:

Worksheets(1).ScrollArea = "a1:f10"

ScrollArea = a sandbox that you define. Users can't leave the sandbox
itself and you can generally control how much of the surrounding park they
are allowed to see from the sandbox (assuming that there is anything to
see).

Once set, the user will not be able to select *OR* scroll to anything
outside of the specified area, regardless of the presence of scroll bars.

For example, if you wanted to set up a frozen "read only" single-screen
sheet, simply set the ScrollArea to A1. Users won't be able to select any
other cell and won't be able to scroll to another part of the worksheet (you
can achieve the first of these with Cell locking but not the 2nd). Note
that ScrollArea is not exactly the same thing as the visible area. They will
still be able to see as much of the sheet as would fit on their screen
starting with A1. This visible area can vary per the users screen
resolution, zoom setting, etc. However, seeing and being allowed to touch
are very different things :-)

Hope this helps,
 
Back
Top