PDA

View Full Version : Solved: Limit Scrolling VBA



gimli
05-18-2010, 06:59 AM
Heyall,

Im trying to limit scrolling like this


Option Explicit
Private Sub Workbook_Open()
Sheet1.ScrollArea = "a1:q46"
Sheet2.ScrollArea = "a1:k13"
End Sub


Sheet 2 does not limit the scrolling..only sheet 1 works...any ideas to why?

thanks mucho grande

lynnnow
05-18-2010, 07:07 AM
Do you mean sheet2 is not scrolling? The reason is because you have set the limit to K13, which is already on the screen and there is no need to scroll anywhere beyond that point.

HTH

Lincoln

gimli
05-18-2010, 07:11 AM
No, I mean I can scroll outside the limits of a1:k13 on sheet 2. Sheet 1 works fine...im limited to a1:q46.

lynnnow
05-18-2010, 07:24 AM
I tried it with Office 2003 and the code you have shown works fine. Which version of Excel are you using?

Lincoln

gimli
05-19-2010, 11:38 AM
Ahh ok...I do have excel 2003.

I have sheet 1 in my workbook renamed to a custom name...but calling it sheet 1 in the code works for that. Sheet 2 is also renamed and it doesnt work for that.

So..if the sheets are named sheet 1 and sheet 2 it works.

How can I alter that statement I posted to accomodate custom sheet names?

Lets say sheet 1 is named - Cortney and sheet 2 is named Amanda?

gimli
05-20-2010, 04:22 AM
Ok...got it now..this works.


Option Explicit
Private Sub Workbook_Open()
Sheets("Cortney").ScrollArea = "a1:q46"
Sheets("Amanda").ScrollArea = "a1:L17"
End Sub