+ Reply to Thread
Results 1 to 6 of 6

Open Workbook At A Set Page

  1. #1
    Brian Hearty via OfficeKB.com
    Guest

    Open Workbook At A Set Page

    There is a web site called www.officearticles.com that explains some good
    tips on using excel. However, I am having difficulties getting one of the
    tips to work.
    To ensure that a workbook is opened at a specific page regardless of where
    the last user was within the book when he/she saved and closed it the
    following piece of VB code is suggested:

    While in Visual Basic Editor, double-click ThisWorkbook and enter the
    following code:
    Private Sub Workbook_Open()
    Range("Sheet1!A1").Activate
    End Sub

    Unfortunately I get a run time error each time I attempt to run it - is there
    something extra that needs to be included in the code in order for it to run
    correctly?


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...excel/200511/1

  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 morning Brian Hearty

    The code seems sound enough, and from your description, you are certainly pasting it to the right place. But do you have a sheet named "Sheet1"...?

    HTH

    DominicB

  3. #3
    Roger Govier
    Guest

    Re: Open Workbook At A Set Page

    Hi Brian

    Do you have a Sheet1?
    If not change code to include your sheet name.

    Regards

    Roger Govier


    Brian Hearty via OfficeKB.com wrote:
    > There is a web site called www.officearticles.com that explains some good
    > tips on using excel. However, I am having difficulties getting one of the
    > tips to work.
    > To ensure that a workbook is opened at a specific page regardless of where
    > the last user was within the book when he/she saved and closed it the
    > following piece of VB code is suggested:
    >
    > While in Visual Basic Editor, double-click ThisWorkbook and enter the
    > following code:
    > Private Sub Workbook_Open()
    > Range("Sheet1!A1").Activate
    > End Sub
    >
    > Unfortunately I get a run time error each time I attempt to run it - is there
    > something extra that needs to be included in the code in order for it to run
    > correctly?
    >
    >


  4. #4
    Brian Hearty via OfficeKB.com
    Guest

    Re: Open Workbook At A Set Page

    Hi Roger

    Thanks for the response. Yes I've tried Sheet1 and an actual sheet name but
    no success either way.

    Brian


    Roger Govier wrote:
    >Hi Brian
    >
    >Do you have a Sheet1?
    >If not change code to include your sheet name.
    >
    >Regards
    >
    >Roger Govier
    >
    >> There is a web site called www.officearticles.com that explains some good
    >> tips on using excel. However, I am having difficulties getting one of the

    >[quoted text clipped - 12 lines]
    >> something extra that needs to be included in the code in order for it to run
    >> correctly?



    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...excel/200511/1

  5. #5

    Re: Open Workbook At A Set Page

    Try this instead

    Private Sub Workbook_Open()

    Worksheets("Sheet1").Activate
    Range("A1").Activate

    End Sub


  6. #6
    Brian Hearty via OfficeKB.com
    Guest

    Re: Open Workbook At A Set Page

    Top Man!
    Thanks for all the responses on this, the last one from stringstroker62 works
    a dream.

    Thanks
    Brian

    [email protected] wrote:
    >Try this instead
    >
    > Private Sub Workbook_Open()
    >
    >Worksheets("Sheet1").Activate
    >Range("A1").Activate
    >
    >End Sub



    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...excel/200511/1

+ 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