+ Reply to Thread
Results 1 to 7 of 7

Open Worksheet to Specific Position

  1. #1
    Registered User
    Join Date
    11-07-2013
    Location
    Clitheroe
    MS-Off Ver
    2016
    Posts
    29

    Open Worksheet to Specific Position

    I have a worksheet with data from Column A to column AP.
    I 'always' want to work in the data in columns Z to AG.

    Is there a way to ensure that the worksheet always opens with column Z at the left of the visible window?

    Thanks,
    Steve

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Open Worksheet to Specific Position

    Yes. You need to add code to the worksheet_activate event, for the specific worksheet, inside the visual basic editor.

    Do you want the top-most cell to be Z1?

    Example: Look at the attached file - see what happens when you 'select' the tab named SELECT ME.


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by GeneralDisarray; 11-05-2015 at 05:14 PM.
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    11-07-2013
    Location
    Clitheroe
    MS-Off Ver
    2016
    Posts
    29

    Re: Open Worksheet to Specific Position

    Thanks. This works when I have the workbook open and click on the relevant worksheet tab.
    However, if I save and close the workbook with the worksheet anywhere other than column Z (say column C), it reopens to column C.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Open Worksheet to Specific Position

    I'll give you the poor man's simple way, before closing it go to column z then save it and close. Next time you open it it should be where you want it.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Open Worksheet to Specific Position

    Oh, you can also use custom views to set up the view you want.

  6. #6
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Open Worksheet to Specific Position

    @steveal
    However, if I save and close the workbook with the worksheet anywhere other than column Z (say column C), it reopens to column C.
    The reason that is happening, is because the workbook is opening with the worksheet already selected. In other words, the worksheet_activate() event is not being fired.


    Here's what you can do (all this is done in the attachment).

    1) Move the code to a new module - because we are going to be calling it from multiple events and only want to make changes in one place. In the attached file I moved the code to 'Module1'

    Please Login or Register  to view this content.
    2) Edit the code of the TARGET worksheet object to call this routine in the worksheet_activate event.

    Please Login or Register  to view this content.
    3) Finally - add a workbook_open() event to the 'ThisWorkbook' code module as follows. NOTE: I gave the target sheet a 'codeName' of w_TargetSheet (in the VBA project-properties). You would have to do the same in your workbook to refer to it like I have below.

    Also - I don't know how many worksheets are in your workbook, or what you want to happen if they save the workbook with another sheet active -- that red part of the event just forces w_targetSheet to be active when opening the book (you can just take that out if you don't want to do that).

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-07-2013
    Location
    Clitheroe
    MS-Off Ver
    2016
    Posts
    29

    Re: Open Worksheet to Specific Position

    GeneralDisarray,

    Thanks for that - it works perfectly! (although it was on the limit of my poor Excel skills to follow your instructions).

    Steve

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel to open specific worksheet
    By hkbhansali in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-24-2014, 01:04 PM
  2. [SOLVED] How to open a proccess at a specific screen position using SHELL?
    By Rhudi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2013, 12:55 PM
  3. Open on specific worksheet
    By antony moseley in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2009, 07:34 AM
  4. Placing a worksheet in a specific position
    By duckboy1981 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-06-2009, 02:36 PM
  5. Open Specific Worksheet
    By cargor in forum Excel General
    Replies: 4
    Last Post: 07-12-2006, 01:10 PM
  6. Open a specific worksheet
    By don in forum Excel General
    Replies: 2
    Last Post: 11-25-2005, 08:15 AM
  7. Open on specific worksheet
    By Adrian in forum Excel General
    Replies: 1
    Last Post: 10-27-2005, 01:05 PM
  8. [SOLVED] How do I open a specific worksheet using windows exp...
    By vertblancrouge in forum Excel General
    Replies: 4
    Last Post: 04-19-2005, 04:06 PM

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