+ Reply to Thread
Results 1 to 8 of 8

Auto selection of worksheet

  1. #1
    Registered User
    Join Date
    06-13-2006
    Posts
    7

    Auto selection of worksheet

    I have a workbook with Mon-Sat worksheets. I would like it to initially open to the appropriate day of the week worksheet based upon the current day of the week. It must allow me to navigate between the various sheets after the open. Can anyone offer help on this?

    Thank you
    Scoobydoo2006

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello scoobydoo2006,

    From your post it looks like the worksheet names are sun, mon, tue, etc. If this is true, this macro will work for you.

    Here is the procedure to install the macro...

    1) First copy the macro to the clipboard using CTRL+C.
    2) Open the Workbook the macro will be run in.
    3) Press ALT+F11 to open the VBA editor.
    4) Press CTRL+R to display the Properties Window.
    5) You should see your Worksheet names listed below the folder "Microsoft Excel Objects". If you do see them skip to step 7.
    6) Press either the Up Arrow or Down Arrow to highlight "Microsoft Excel Objects". Press the Right Arrow key to open the folder.
    7) If "ThisWorkbook" is not highlighted, use either the Up Arrow or Down Arrow keys to highlight it.
    8) Press the "Enter" key. The cursor will move to the code window.
    9) Press CTRL+V to paste the macro code.
    10) Press CTRL+S to Save the macro.
    11) Press ALT+Q to close the VBA editor and return to Excel.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    06-13-2006
    Posts
    7

    That works!

    I actually had the days spelled out but I changed it and your code works. I tried to expand it to 8-ddd... for the full name of the day but it errored. If you know how to use the full day name please pass it on and I will use it. If not, thanks for what you gave me.

    Scooby

  4. #4
    Paul B
    Guest

    Re: Auto selection of worksheet

    Scoobydoo2006, try 4 d's

    ThisWorkbook.Worksheets(Format(Now, "dddd")).Activate


    --
    Paul B
    Always backup your data before trying something new
    Please post any response to the newsgroups so others can benefit from it
    Feedback on answers is always appreciated!
    Using Excel 2002 & 2003

    "scoobydoo2006" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > I actually had the days spelled out but I changed it and your code
    > works. I tried to expand it to 8-ddd... for the full name of the day
    > but it errored. If you know how to use the full day name please pass it
    > on and I will use it. If not, thanks for what you gave me.
    >
    > Scooby
    >
    >
    > --
    > scoobydoo2006
    > ------------------------------------------------------------------------
    > scoobydoo2006's Profile:

    http://www.excelforum.com/member.php...o&userid=35372
    > View this thread: http://www.excelforum.com/showthread...hreadid=561303
    >




  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Scooby,

    Change the "ddd" to "dddd" to get the full name of the day. Here is the code with the change...

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  6. #6
    Registered User
    Join Date
    06-13-2006
    Posts
    7
    Thank you! Works great!

    Scooby

  7. #7
    Registered User
    Join Date
    06-13-2006
    Posts
    7

    Different scenario

    This time the sheets are named by the months instead of weekdays. Tried to alter your formula with "mmmm" but errored. Couldn't find a good reference for the month format. Any help is appreciated.

    Scooby

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Scooby,

    The "mmmm" in the format statement will return the full month name. Can you post your code along with the error message you receive?

    Sincerely,
    Leith Roaa

+ 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