+ Reply to Thread
Results 1 to 13 of 13

Open a hidden sheet with clicking a button

  1. #1
    Registered User
    Join Date
    08-23-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2010
    Posts
    8

    Open a hidden sheet with clicking a button

    Hey All,

    I have a workbook including several sheets.

    I'd like to hide all worksheets and in the excel there is only one visible sheet which is Navigation Page. I want to add several buttons on this sheet and each button will be clicked to call the other sheets.

    For example, there is a sheet called Sales_Approval_Form and I'd like to add a button on navigation page called Sales Approval Form and when the user clicks the button the sheet will be open for entering data.

    So, Could you help me on this?

    Thanks,

    Emre

  2. #2
    Registered User
    Join Date
    10-11-2011
    Location
    FB Republic
    MS-Off Ver
    2016
    Posts
    36

    Re: Open a hidden sheet with clicking a button

    welcome to the forum.

    add an activex commandbutton in navigation sheet.

    double click the button in design mode to view the worksheet's code module

    paste the following.

    Please Login or Register  to view this content.
    you can delete the ".Activate" line if you dont want to activate the sheet.

    you can also rehide that worksheet after selecting another worksheet.
    paste the following in that worksheet's code module. (right click the tab name, click "view code".)

    Please Login or Register  to view this content.
    Last edited by mancubus; 08-23-2013 at 07:36 AM. Reason: typo

  3. #3
    Registered User
    Join Date
    08-23-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Open a hidden sheet with clicking a button

    Thanks for your reply. It worked with the codes.

    I have another issue with this. Now a user can click the button to open the hidden sheet and is able to fill the form. After filling, I need to have an export file button to save the file as another excel workbook to a folder that user wants. There is also a button to empty the fields(I mean refresh the form) which are entered by user.

    And also on the navigation page there are one more button which are used to call the existing document where the user save as I mentioned above.

    I'll be glad if you can help on those?

    Thanks...

  4. #4
    Registered User
    Join Date
    10-11-2011
    Location
    FB Republic
    MS-Off Ver
    2016
    Posts
    36

    Re: Open a hidden sheet with clicking a button

    1)
    Please Login or Register  to view this content.
    3)
    Please Login or Register  to view this content.

    2)
    you may use Clear or ClearContents method, if you mean a range...

    example:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-23-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Open a hidden sheet with clicking a button

    Thank you very much for your help.

    I have tested and it worked fine. I just checked the functionality as a whole and let you know if I need assistance.

    By the way, how can I changed the 1st code you wrote for saving as just the sheet opened instead of whole workbook.

    is it work like this?

    Worksheets("Sales").SaveCopyAs fPath & fName & ".xlsm"

    Thanks

  6. #6
    Registered User
    Join Date
    10-11-2011
    Location
    FB Republic
    MS-Off Ver
    2016
    Posts
    36

    Re: Open a hidden sheet with clicking a button

    you are welcome.

    try:

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

  7. #7
    Registered User
    Join Date
    08-23-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Open a hidden sheet with clicking a button

    Hi again,

    Is is possible to open only one sheet (Navigation Page, for instance) when the excel file is open?

    I did all thing you wrote, but after I close the excel, it will be normally open as I left. What I want is that when a user close the excel and open the same file again, he/she will see only the navigation page and the other sheets are hidden.

    Can you help me on this?

    Emre

  8. #8
    Forum Contributor
    Join Date
    08-11-2012
    Location
    bengalur
    MS-Off Ver
    Excel 2003, 2007
    Posts
    152

    Re: Open a hidden sheet with clicking a button

    Yes you can open only one sheet you need.

    Assume that Sheet1 is the sheet which you need to visible and rest all invisible.

    Please try below code in Workbook Open Event

    Please Login or Register  to view this content.
    ___________________________________________________________________________________________________________________________________
    Please click * to say thank you

  9. #9
    Forum Contributor
    Join Date
    08-11-2012
    Location
    bengalur
    MS-Off Ver
    Excel 2003, 2007
    Posts
    152

    Re: Open a hidden sheet with clicking a button

    Yes you can open only one sheet you need.

    Assume that Sheet1 is the sheet which you need to visible and rest all invisible.

    Please try below code in Workbook Open Event

    Please Login or Register  to view this content.
    ___________________________________________________________________________________________________________________________________
    Please click * to say thank you

  10. #10
    Registered User
    Join Date
    08-23-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Open a hidden sheet with clicking a button

    Thanks, it is working...

    By the way, everytime I click the save button for workbook, it always opens the "Save As" window with a different name. And also, everytime I have to choose macro enabled format to save.

    My workbook names as Business Case, when I tried to save, it adds rename as BusinessCase1 and ask me to choose file format etc.

    Why does it happen like this?

  11. #11
    Registered User
    Join Date
    08-23-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Open a hidden sheet with clicking a button

    I saved as a macro enabled template each time, that's why I got a renamed file name

  12. #12
    Registered User
    Join Date
    08-23-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Open a hidden sheet with clicking a button

    Hey All,

    Below Code works for exporting the file, but when I select cancel from the brows window after clicking the export file button, system also opens the xlsx file which I want to export as well. I want it to do nothing when the user clicks cancel.

    How can I modify the code?

    Sub TWB_SaveCopyAs()

    Dim fPath As String, fName As String

    fName = Application.UserName 'this is an example. change to suit your needs.

    With Application.FileDialog(msoFileDialogFolderPicker)
    .AllowMultiSelect = False
    .Show
    If .SelectedItems.Count > 0 Then
    fPath = .SelectedItems(1)
    End If
    End With

    ThisWorkbook.SaveCopyAs fPath & fName & ".xlsm"

    End Sub

  13. #13
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Open a hidden sheet with clicking a button

    Here:

    Please Login or Register  to view this content.

    Mark the thread as solved using the Thread Tools.

    If you appreciate my help, please click on '* Add Reputation' (bottom left hand corner of this post).
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

+ 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] Clicking that open button from file download. My project contd...
    By Zaf01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2012, 08:02 AM
  2. [SOLVED] Show hidden wrksht(s) by clicking a button on an always visible wrksht, in same wrkbk
    By jakeh2475 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2012, 01:35 AM
  3. Replies: 2
    Last Post: 02-13-2011, 01:22 PM
  4. open a project after clicking a button
    By Nancy123 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 10-19-2010, 05:02 AM
  5. Replies: 3
    Last Post: 07-29-2010, 06:47 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