+ Reply to Thread
Results 1 to 17 of 17

Stop Scrolling

  1. #1
    Registered User
    Join Date
    12-17-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    11

    Stop Scrolling

    We are trying to stop scrolling in range by using View->Tool Bars-> Control Bar -> Properties. We insert a range to lock the scroll area. This works fine. However, when we save the file - and then reopen the file, the scroll lock is gone. Please advise as to how to save the scroll lock range successfully so that other users will stay in the presribed range only. Thanks.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Stop Scrolling

    Hi victorjesse,
    Record a macro of the steps then add this code to the open workbook module
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    12-17-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Stop Scrolling

    pike

    Thanks, but the macro will not record. I have 13 modules in my workbook - so I am not sure which module should have the code if I finally find a way to record the macro. I have also tried the "Developer" tab followed by "Properties" and then setting the scroll area. This works but the scroll area settings are lost after saving, closing and opening again. I cannot record these steps either. I am simply trying to limit scrolling to a defined range. It seem that there must be an easy way to accomplish this. Please advise. Thanks
    ,

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Stop Scrolling

    Workbook Event code should be added to the workbook code module:
    Please Login or Register  to view this content.
    Copy the Excel VBA code that you want to use
    Select the workbook in which you want to store the code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    In the Project Explorer, find your workbook, and open the list of Microsoft Excel Objects
    Right-click on the ThisWorkbook object, and choose View Code
    Where the cursor is flashing, choose Edit | Paste

  5. #5
    Registered User
    Join Date
    12-17-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Stop Scrolling

    Thanks for your help.

    I opened my workbook and selected "ThisWorkbook" in the Visual Basic Editor list and chose View Code.

    I inserted the following: Worksheets(1).ScrollArea = "a1:f10" ..... Result - no luck.
    So I tried: Worksheets("Selection").ScrollArea = "a1:f10" .... where "Selection" is the tab name of the sheet - Again no Luck
    So I tried: Worksheets("30").ScrollArea = "a1:f10" .... where "30" is the number of the sheet in the VBA Editor List - Still no Luck
    I also tried: Sheets(30).ScrollArea = "a1:f10" .... because "sheets" works with other macros to define sheets - but still no joy.

    Sorry to be so thick - and persistant. Would appreciate any other suggestions you may have.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Stop Scrolling

    try the attachmentA ScrollArea.xlsm

  7. #7
    Registered User
    Join Date
    12-17-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Stop Scrolling

    Pike

    Thanks for all your help. I copied your code directly into VBA code editor section for the Sheet on which I want to limit scrolling - and changed the sheet number in the code as appropriate. I also tried copying your code with the proper sheet number into the code section of ThisWorkbook. Neither worked. I give up.

    I am a bit surprised that the Developer -> Properties -> Scroll Area ... approach does not work. It works fine while the workbook is open but the scroll area range is cleared if the workbook is saved and then opened again. This seems to be a very straight forward solution but it cannot be saved. I don't really understand the purpose of allowing for scroll area limits to be set but not saved.

    In any case, I am stopped and will resort to hiding columns and rows to keep users from straying too far from my range. Unless you have another idea. I hope macros will work - even when the rows from which the macro looks for data are hidden - have not tested that yet.

    Thanks again

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Stop Scrolling

    can you attach the problem workbook

  9. #9
    Registered User
    Join Date
    12-17-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Stop Scrolling

    Attached is a copy of the file. I have removed about 70% of the sheets to get under the size limit allowed for attachments - the workbook is confidential and still under development.
    The tab marked "Selection" is the sheet on which I want to limit scrolling to a range of A1:W72.
    I really appreciate any comments or suggestions you may have - on scrolling or any other errors or problems you may see.

    Thanks
    Victor
    Attached Files Attached Files

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Stop Scrolling

    Worksheet event code is stored on a worksheet module. To add it to your worksheet, do the following:
    Please Login or Register  to view this content.
    Copy the code
    Select the worksheet in which you the code to run
    Right click on the sheet tab and choose View Code, to open the Visual Basic Editor.
    Where the cursor is flashing, choose Edit | Paste

  11. #11
    Registered User
    Join Date
    12-17-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Stop Scrolling

    Thanks for your response.

    I copied the code and entered it exactly as you instructed. I still does not work. I also tried a couple variations such as using the number of the sheet "30" instead of "Selection" but - no luck. I also entered the code in Module 1 as a test but that did nothing.

    I assume the code worked for you - with the file I sent. Therefore, I am beginning to wonder if my Excel 2010 is not installed properly - or if there is a toggle switch or setting that is not set properly to allow for event code. I am now chasing down the subject of event code to see if there is something amiss. If the code worked for you in my workbook, perhaps you could send attach the file with code inserted - so that I can compare it to mine. This seems very strange.

    In any case, thanks again for your efforts.

    Best Regards,
    Victor

  12. #12
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Stop Scrolling

    victorjesse
    try this its our last chance before I go on Christmas Break

    Sizing Example - Excel Forum Upload test.xls

  13. #13
    Registered User
    Join Date
    12-17-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Stop Scrolling

    Pike

    Yes, it works.... but it now locks all the pages in the range of a1:a10 as per your code. When I change the code to a1:w27, however, the sheets remain locked in the a1:a10 range. Also, I really don't understand why the code you entered would show up as the same code on every sheet - and limits the range on every sheet. I don't understand why it works in the a1:a10 range now - but the same exact code would not work for me. Of course, it will not help if I cannot alter the code to allow a wider range and limit the effect of the range only to the page call "Selection" .... again, as of now, it is locked in the a1:a10 range. There seems to be a basic issue or problem with how I am saving the file - or the functionality of my version of Excel 2010.

    Any thoughts you have will be appreciated.

    Have a nice Christmas

    Victor

  14. #14
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Stop Scrolling

    The code is in the worksheet modules you can change the range to suit or delete the code if its not required

  15. #15
    Registered User
    Join Date
    12-17-2011
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Stop Scrolling

    Happy New Year.

    This code you suggested works until I save the file and re-open it. Even the file you sent lost its functionality after I saved it and re-opened. Over the holidays, I re-installed Excel 2010 but that did not help. I have been saving the file in xls format since most of my associates are still using the old version of Excel. I also tried saving as xlsx but that did not help. I have moved on - hiding cells rather than restricting scroll area because I am running out of time. However, if you have any other ideas, it would be greatly appreciated. Seems like this should be a simple thing but no luck so far.

  16. #16
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Stop Scrolling

    hmmmm. can you attach the problem workbook?

  17. #17
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Stop Scrolling

    Hello..
    Please Login or Register  to view this content.
    I put the above in the ThisWorkbook module. It's all working as it's supposed to here.
    I hopefully have attached the file. Boy they made that attachment thingy complicated
    Have Fun

+ 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