VBA scroll restrictions not working on horizontal scroll...?

Novelec

Board Regular
Joined
Nov 3, 2012
Messages
85
Hi guys,

I am trying to lock the scroll areas in my work book. There are several sheets, each with a different area to be restricted.

I tried the sheet properties in the VBA window, only to find these values aren't carried over when the workbook is reopened. So I am trying my luck with some code. I've put the code listed below in "ThisWorkbook" module, so it operates upon the Workbook opening.

The code works restricting vertical scroll area, but horizontal scroll is still "unlimited"...? There are no errors, the horizontal scroll just keeps scrolling past where its supposed to stop. Can anyone shed some light on this one?

Everyone's help is always appreciated, I've been learning lots from this forum. :)

Code:
Worksheets("Worksheet 1 Name").ScrollArea = "$A$1:$U$54"
Worksheets("Worksheet 2 Name").ScrollArea = "$A$1:$U$465"
'etc...


I've also tried:

Code:
Worksheets("Worksheet 1 Name").ScrollArea = "A1:U54"
Worksheets("Worksheet 2 Name").ScrollArea = "A1:U465"
'etc...
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
With this code I cannot move beyond column U and below row 54 on Sheet1:

Code:
Sub Test()
    Worksheets("Sheet1").ScrollArea = "A1:U54"
End Sub

Are you experience different behaviour?
 
Upvote 0
Are you experience different behaviour?

Hi Andrew,

Thanks for the test. Using the code I am still able to scroll horizontally...? However I am starting to think my problem is hardware/software related...

The file containing this code was produced on a PC, running Excel 2010. The function works on this PC, locking both x and y axis scrolling.

However, when I use the same file on a Dell tablet computer (Also Excel 2010), I run into the scrolling issue.

Could this be an issue from outside Excel?
 
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,179
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top