+ Reply to Thread
Results 1 to 12 of 12

Definable scrolling

  1. #1
    Registered User
    Join Date
    11-29-2008
    Location
    Southeast
    Posts
    22

    Definable scrolling

    I've created a worksheet with split panes. I'm able to scroll through my data vertically and horizontally while keeping one area of th screen stationary. Here's my question:

    Is there a way to limit the movement of my scroll bars so that it can't move beyond the viewable portion of my worksheet? In other words, I want the scrolling to end when there is nothing else to see but a field of empty cells.

    Thanks.
    Last edited by HuntnPeck; 12-06-2008 at 09:18 PM.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon HuntnPeck
    Quote Originally Posted by HuntnPeck View Post
    Is there a way to limit the movement of my scroll bars so that it can't move beyond the viewable portion of my worksheet? In other words, I want the scrolling to end when there is nothing else to see but a field of empty cells.
    Yes, but not via the ordinary menus, you have to do it via the VBE.
    Press Alt + F11 to open the VBE and find the sheet you want to limit in the tree structure on the left.

    Then in the preoperties window, find the ScrollArea property and set it to, say, A100:Z100. This property would not save with the worksheet so will need resetting with every session.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    you can also use this code in the workbook module
    Please Login or Register  to view this content.
    then when book is opened in this instance only A1:I10 can be scrolled on sheet 1

  4. #4
    Registered User
    Join Date
    11-29-2008
    Location
    Southeast
    Posts
    22
    Quote Originally Posted by martindwilson View Post
    you can also use this code in the workbook module
    Please Login or Register  to view this content.
    then when book is opened in this instance only A1:I10 can be scrolled on sheet 1
    Ok, I tried this, but I got a message saying something about not being able to use macros. I'm new to this and I'm using Excel 2007. I'm not sure what a "macro" is, and when I do a ALT/F11, I don't understand the difference between the "General" section and the "Workbook" section. Do I just copy and paste the info above and then save and close, or do I have to do something additional before closing the "VBA"? (I'm not even sure what the VBA is).

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    not sure how 2007 is set up,but you should be able to run macros if yoou allow them,then again your company may have set it so you cant!
    that code goes in the workbook module
    see image
    Attached Images Attached Images

  6. #6
    Registered User
    Join Date
    11-29-2008
    Location
    Southeast
    Posts
    22
    Quote Originally Posted by martindwilson View Post
    not sure how 2007 is set up,but you should be able to run macros if yoou allow them,then again your company may have set it so you cant!
    that code goes in the workbook module
    see image
    Excellent! That was very helpful. I managed to finally get one worksheet corrected so that the scroll area was limited to the area I desired. However, I now need to know how to apply this to the other sheets in my workbook. When I open the next sheet and use ALT/F11, I see the same code that I applied to the previous sheet. Do I simply edit the sheet name in the code?

    The code I have entered looks like this:

    Private Sub Workbook_Open()
    Worksheets("Internship 1").ScrollArea = "A1:BX65"
    End Sub

    Sheet 1 is named "Internship 1". My next sheet is named "Internship 2". I'm not sure if I just edit the name of the sheet on the command line or enter an entirely separate command.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    just add it in

    Private Sub Workbook_Open()
    Worksheets("Internship 1").ScrollArea = "A1:BX65"
    Worksheets("Internship 2").ScrollArea = "A10:CD89"
    End Sub

  8. #8
    Registered User
    Join Date
    11-29-2008
    Location
    Southeast
    Posts
    22
    Quote Originally Posted by martindwilson View Post
    just add it in

    Private Sub Workbook_Open()
    Worksheets("Internship 1").ScrollArea = "A1:BX65"
    Worksheets("Internship 2").ScrollArea = "A10:CD89"
    End Sub
    Thanks. How do I tag this post as "solved"?

  9. #9
    Registered User
    Join Date
    07-02-2008
    Location
    Fort Worth, TX
    Posts
    99
    Quote Originally Posted by HuntnPeck View Post
    Excellent! That was very helpful. I managed to finally get one worksheet corrected so that the scroll area was limited to the area I desired. However, I now need to know how to apply this to the other sheets in my workbook. When I open the next sheet and use ALT/F11, I see the same code that I applied to the previous sheet. Do I simply edit the sheet name in the code?

    The code I have entered looks like this:

    Private Sub Workbook_Open()
    Worksheets("Internship 1").ScrollArea = "A1:BX65"
    End Sub

    Sheet 1 is named "Internship 1". My next sheet is named "Internship 2". I'm not sure if I just edit the name of the sheet on the command line or enter an entirely separate command.

    Remember, if you change your sheet name, you will have to edit the code to point to the new name. Macros do not update like cell references do to changes, they have to be done manually.

    If you send this to others, be sure to warn them about the macros or they will probably either not know to enable them, or choose to disable them when prompted.

    To change your post status, use the edit command.

  10. #10
    Registered User
    Join Date
    11-29-2008
    Location
    Southeast
    Posts
    22
    Quote Originally Posted by Tirren View Post
    Remember, if you change your sheet name, you will have to edit the code to point to the new name. Macros do not update like cell references do to changes, they have to be done manually.

    If you send this to others, be sure to warn them about the macros or they will probably either not know to enable them, or choose to disable them when prompted.

    To change your post status, use the edit command.
    Ok, thanks for the tip.

  11. #11
    Valued Forum Contributor ratcat's Avatar
    Join Date
    03-07-2008
    Location
    Rural NSW, Australia
    MS-Off Ver
    Vista 2007
    Posts
    1,111
    Quote Originally Posted by HuntnPeck View Post
    Thanks. How do I tag this post as "solved"?
    Read below in my sig

    Cheers
    Have I made you happy ??? If yes, please make me happy by pressing the http://www.excelforum.com/images/buttons/reputation-40b.png Add Reputation button in my post.
    Please don't forget to do the same to other contributors of this forum.

    Thanks
    I don't void confusion, I create it

  12. #12
    Registered User
    Join Date
    11-29-2008
    Location
    Southeast
    Posts
    22
    Quote Originally Posted by ratcat View Post
    Read below in my sig

    Cheers
    Well, I was actually going to mark this post "solved", but apparently it still needs a tweak. I installed macros for my firsy two worksheets to define the scroll area parameters. The first sheet functions normally, but the second is generating a runtime error 9. I have no idea what that means or what to do about it. Anyone got enough patience left to help me see this through to a successful resolution? I'm sorry to be so much trouble. I'm just a rookie trying to learn as I go. I do appreciate all the help that I've received.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1