+ Reply to Thread
Results 1 to 7 of 7

Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked

  1. #1
    Registered User
    Join Date
    06-29-2010
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    21

    Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked

    Hi,

    I have the following code in a module

    Sub goto_sheet()
    Sheets("Thyristors").Select
    End Sub
    Sub back_to_sheet()
    Sheets("Main Menu").Select
    End Sub


    On the Thyristors sheet I have a button that says Main menu, when clicked it takes me back to the Main menu.

    On the Main Menu sheet I have button that says Thyristors, when clicked it takes me to the Thyristors worksheet.

    I have identical modules for several worksheets so I can go back and to each sheet from the main menu.

    I wanted to tidy up my spreadsheet and hide all the sheets other than the main menu sheet. But if I hide a sheet I then get an error when my macro buttons are used to open them.

    What do I need to change to the code?

    Many thanks for your help.

  2. #2
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked

    First you need to edit your post and insert the code in CODE tags so it looks like this:

    Please Login or Register  to view this content.
    You that by clicking Edit Post and then highlight the code and press # next to the <> sign and hit save.

    For your problem.
    You can use this:
    Please Login or Register  to view this content.
    For going back to main menu:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-29-2010
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked

    Hi,

    Thank you for your reply.

    I've tried the code but I get the following run time error 438 "Object doesn't support this property or method"

    When I select Debug it then highlights the following line under the Sub goto_sheet

    <Sheets("Thyristors").Hidden = False>

    Any ideas?

    Regards Owain

  4. #4
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked

    Sory...replace the Hidden with Visible
    So your codes are now:
    Please Login or Register  to view this content.
    And
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked

    Quote Originally Posted by stojko89 View Post
    First you need to edit your post and insert the code in CODE tags so it looks like this:

    Please Login or Register  to view this content.
    You that by clicking Edit Post and then highlight the code and press # next to the <> sign and hit save.


    Also please check this reminder and do as asked.

  6. #6
    Registered User
    Join Date
    06-29-2010
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked

    Thanks for your help. Getting there now. I can now open the hidden Thyristor sheet, but the the go back option to main menu isn't working? Click the button and nothing happens even though I've assigned code to it. Any ideas? Your replies are much appreciated.

  7. #7
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked

    This works fine for me:

    Please Login or Register  to view this content.
    Does it hide the active sheet?
    Also check if your sheet is named Main Menu and not Main Menu (space difference) also check that the name of the Main Menu sheet is the same in the macro.

+ 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