Consulting

Results 1 to 6 of 6

Thread: Solved: Limit Scrolling VBA

  1. #1

    Solved: Limit Scrolling VBA

    Heyall,

    Im trying to limit scrolling like this

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

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

    thanks mucho grande

  2. #2
    VBAX Tutor lynnnow's Avatar
    Joined
    Jan 2005
    Location
    Mumbai, Maharashtra, India
    Posts
    299
    Location
    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

  3. #3
    No, I mean I can scroll outside the limits of a1:k13 on sheet 2. Sheet 1 works fine...im limited to a1:q46.

  4. #4
    VBAX Tutor lynnnow's Avatar
    Joined
    Jan 2005
    Location
    Mumbai, Maharashtra, India
    Posts
    299
    Location
    I tried it with Office 2003 and the code you have shown works fine. Which version of Excel are you using?

    Lincoln

  5. #5
    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?

  6. #6
    Ok...got it now..this works.

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

Posting Permissions

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