+ Reply to Thread
Results 1 to 6 of 6

open worksheet based on month to specific sheet named after month and hide rest

  1. #1
    Registered User
    Join Date
    11-06-2013
    Location
    San Jose, California
    MS-Off Ver
    Excel 2010
    Posts
    36

    open worksheet based on month to specific sheet named after month and hide rest

    Hi All, I am trying to get my workbook to open to a specific sheet depending on what month it is and automatically hide the rest, I have 12 sheets named after each month i.e january,feburary ect. The code i have manage to scrape up and put together via multiple searches seems to work but creates an error. When i open sheet it opens to january but then creates this error (method "visible" of object'_worksheet failed ) any help would greatly be appreciated see code below. i have this code in the Thisworkbook module

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: open worksheet based on month to specific sheet named after month and hide rest

    befor you make your loop, make that sheet oName visible, otherwise a certain moment it can happen that no sheet at all is visible and excel doesn't like that.
    so before the for each ... you add "worksheets(oName).visible=true"

  3. #3
    Registered User
    Join Date
    11-06-2013
    Location
    San Jose, California
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: open worksheet based on month to specific sheet named after month and hide rest

    sorry tried adding the code you suggested before the for each,,, but it still creates exact same error ??

  4. #4
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: open worksheet based on month to specific sheet named after month and hide rest

    Please Login or Register  to view this content.
    Last edited by bsalv; 01-23-2014 at 03:04 AM.

  5. #5
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: open worksheet based on month to specific sheet named after month and hide rest

    Suppose your sheet names "JaNuArY" to make it difficult.
    maybe you should use strcomp or use "option compare text" above in your module, if it's still not working.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-06-2013
    Location
    San Jose, California
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: open worksheet based on month to specific sheet named after month and hide rest

    Quote Originally Posted by bsalv View Post
    Suppose your sheet names "JaNuArY" to make it difficult.
    maybe you should use strcomp or use "option compare text" above in your module, if it's still not working.
    Please Login or Register  to view this content.
    @ bsalv thank you so much this did it i really appreciate all the help thanks again

+ 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. [SOLVED] Lookup month and calculate if specific month value apply
    By D-smoke in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-24-2013, 03:03 AM
  2. Replies: 2
    Last Post: 12-01-2012, 03:06 PM
  3. [SOLVED] Excel 2007 : Counting date in specific month by month
    By adisakman in forum Excel General
    Replies: 8
    Last Post: 06-14-2012, 06:30 AM
  4. Replies: 4
    Last Post: 03-19-2012, 08:58 AM
  5. Replies: 2
    Last Post: 12-22-2009, 01:14 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