+ Reply to Thread
Results 1 to 8 of 8

Programmatically scrolling to top

  1. #1
    VanS
    Guest

    Programmatically scrolling to top

    Hello,
    I have an Excel VBA app and I need automatically scroll to the top left
    (cell A1) when each worksheet is selected and activated. I tried using the
    Select, Activate and Show methods for the range in the Worksheet_Activate sub
    but they didn't work.
    Any ideas on a simple technique to do so?
    Thanks, God bless
    Van

  2. #2
    K Dales
    Guest

    RE: Programmatically scrolling to top

    Where did you put the code, and how did you write it? Sounds like the idea
    should work; you would need to put the code in each worksheet's module,
    though, to get it to work for every sheet. This code should work:

    Private Sub Worksheet_Activate()

    Range("A1").Select

    End Sub


    "VanS" wrote:

    > Hello,
    > I have an Excel VBA app and I need automatically scroll to the top left
    > (cell A1) when each worksheet is selected and activated. I tried using the
    > Select, Activate and Show methods for the range in the Worksheet_Activate sub
    > but they didn't work.
    > Any ideas on a simple technique to do so?
    > Thanks, God bless
    > Van


  3. #3
    Daniel CHEN
    Guest

    Re: Programmatically scrolling to top


    The following codes worked with me.
    I think it should work with you too, if you do not have any sepcial stuff in
    your sheets.

    Private Sub Worksheet_Activate()
    Range("A1").Select
    End Sub

    ===== * ===== * ===== * =====
    Daniel CHEN

    UDQServices@Gmail.com
    www.Geocities.com/UDQServices
    >Free Data Processing Add-in<

    ===== * ===== * ===== * =====

    "VanS" <VanS@discussions.microsoft.com> wrote in message
    news:7E481BAB-1F25-4126-A99A-2B3158BB93E7@microsoft.com...
    > Hello,
    > I have an Excel VBA app and I need automatically scroll to the top left
    > (cell A1) when each worksheet is selected and activated. I tried using the
    > Select, Activate and Show methods for the range in the Worksheet_Activate
    > sub
    > but they didn't work.
    > Any ideas on a simple technique to do so?
    > Thanks, God bless
    > Van




  4. #4
    David McRitchie
    Guest

    Re: Programmatically scrolling to top

    see
    http://www.mvps.org/dmcritchie/excel...oc.htm#TopLeft

    specifically:
    Application.Goto Reference:=Cells(1, 1), Scroll:=True
    ---
    HTH,
    David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
    My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
    Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

    "VanS" <VanS@discussions.microsoft.com> wrote in message news:7E481BAB-1F25-4126-A99A-2B3158BB93E7@microsoft.com...
    > Hello,
    > I have an Excel VBA app and I need automatically scroll to the top left
    > (cell A1) when each worksheet is selected and activated. I tried using the
    > Select, Activate and Show methods for the range in the Worksheet_Activate sub
    > but they didn't work.
    > Any ideas on a simple technique to do so?
    > Thanks, God bless
    > Van




  5. #5
    Harald Staff
    Guest

    Re: Programmatically scrolling to top

    Hi Van

    The provided solutions will make A1 the selected cell. You may or may not
    want that. If not, put this in the ThisWorkbook module:

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    ActiveWindow.ScrollColumn = 1
    ActiveWindow.ScrollRow = 1
    End Sub

    HTH. Best wishes Harald


    "VanS" <VanS@discussions.microsoft.com> skrev i melding
    news:7E481BAB-1F25-4126-A99A-2B3158BB93E7@microsoft.com...
    > Hello,
    > I have an Excel VBA app and I need automatically scroll to the top left
    > (cell A1) when each worksheet is selected and activated. I tried using the
    > Select, Activate and Show methods for the range in the Worksheet_Activate

    sub
    > but they didn't work.
    > Any ideas on a simple technique to do so?
    > Thanks, God bless
    > Van




  6. #6
    VanS
    Guest

    Re: Programmatically scrolling to top

    Thanks to all of you that replied.
    As indicated the Select method doesn't work though it seems it should. Your
    solutions David and Harald did, so appreciate you help.
    God bless
    Van

    "Harald Staff" wrote:

    > Hi Van
    >
    > The provided solutions will make A1 the selected cell. You may or may not
    > want that. If not, put this in the ThisWorkbook module:
    >
    > Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    > ActiveWindow.ScrollColumn = 1
    > ActiveWindow.ScrollRow = 1
    > End Sub
    >
    > HTH. Best wishes Harald
    >
    >
    > "VanS" <VanS@discussions.microsoft.com> skrev i melding
    > news:7E481BAB-1F25-4126-A99A-2B3158BB93E7@microsoft.com...
    > > Hello,
    > > I have an Excel VBA app and I need automatically scroll to the top left
    > > (cell A1) when each worksheet is selected and activated. I tried using the
    > > Select, Activate and Show methods for the range in the Worksheet_Activate

    > sub
    > > but they didn't work.
    > > Any ideas on a simple technique to do so?
    > > Thanks, God bless
    > > Van

    >
    >
    >


  7. #7
    Registered User
    Join Date
    05-21-2021
    Location
    Phoenix, AZ
    MS-Off Ver
    Current
    Posts
    3

    Re: Programmatically scrolling to top

    ActiveWindow.ScrollRow = 1

  8. #8
    Registered User
    Join Date
    05-21-2021
    Location
    Phoenix, AZ
    MS-Off Ver
    Current
    Posts
    3

    Re: Programmatically scrolling to top

    opps, sorry I missed previous on this.

+ 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