+ Reply to Thread
Results 1 to 22 of 22

Hidden sheet option

  1. #1
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Hidden sheet option

    I have worksheet with 5 tabs(sheets),
    sheets are of individual person, including leaders
    One of the tab/sheet i want is for it to be hidden and open only by the leader.
    So I have here:
    Please Login or Register  to view this content.
    this part works, but any user can go and unhide it if they know how. How I can I have it protected?
    Last edited by EXLent; 06-10-2013 at 11:21 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Hidden sheet option

    Hi, EXLent,

    maybe like this
    Please Login or Register  to view this content.
    Any change in view this sheet could only be done via VBA or via the VBE.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    didn't work. It actually shows instead of hidden.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Hidden sheet option

    Hi, EXLent,

    maybe that is due to the order of commands you have in your Workbook_open? I donīt know the logic behind it but I could imagine to be that code line the first in the procdure and get through the procedure before calling the UserForm.

    Ciao,
    Holger

  5. #5
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    Please Login or Register  to view this content.
    I have a form that I made for user to input data.
    Please Login or Register  to view this content.
    Here i have it visible to leader, which it works correctly
    Please Login or Register  to view this content.
    Here if your username is not listed in the sheet you will get msg and form is close.
    Please Login or Register  to view this content.
    Here I had it before the "IF" statement but when the form pops up, it was actually showing the sheet that was suppose to be hidden.
    Maybe, I should use the open user form at the end?

  6. #6
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: Hidden sheet option

    Set the sheet to
    Please Login or Register  to view this content.
    from the properties window, or alternately add it to the wkb open event BEFORE the form is shown.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Hidden sheet option

    Hi, EXLent,

    from how I would approach this: check that the given worksheet(s) is/are hidden as first action (I would eventually place that command in the Workbook_BeforeClose-Event). After that I would check if the user who opened the workbook is listed and take these actions accordingly. And if the user is not listed: how shall he enter Data into an UF (and more important: where to store this data)? The command I would use would not be Exit Sub as that would leave the workbook and the UF open but Workbook.Close as that user would have no permission to enter the workbook. And sorry: I donīt see why you need myName (must be a gobal Variable while I used it as a local).

    Please Login or Register  to view this content.
    Ciao,
    Holger

  8. #8
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    so I added it before the userform and I got run time error 1004
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    Ok I got it.
    instead of
    Please Login or Register  to view this content.
    i had it
    Please Login or Register  to view this content.
    Now, that it is hidden and no unhide option.
    Will this code below is still True for leader?
    Please Login or Register  to view this content.

  10. #10
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Hidden sheet option

    Hi, EXLent,

    you could check the status of any sheet prior to taking any action like Selecting (for which reason?)
    Please Login or Register  to view this content.
    Ciao,
    Holger

  11. #11
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: Hidden sheet option

    Untested. You could simply use something like the below to Hide/Display the sheet in accord to the Username:
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    The
    Please Login or Register  to view this content.
    is working so far. I'm just wondering when the leader open the workbook(HIDDEN is visible) will the next person who open the workbook see the HIDDEN sheet? Usually in excel it remember last user.

  13. #13
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    So I have confirmed that even with the hidden tab/sheet, if the last thing the last person on was the hidden tab/sheet, it shows up when the next user open up the document before the macro activate.
    So somehow I have to code it to NOT close with the hidden tab/sheet as the last thing.
    How can I preven from this happening?

  14. #14
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Hidden sheet option

    Hi, EXLent,

    Quote Originally Posted by #7
    I would eventually place that command in the Workbook_BeforeClose-Event
    With the Workbook_Open you keep facing the problem of macros being en-/dosabled while with he Workbook_BeforeSave you would need to make sure that any wanted action from the user has been taken in order to save the workbook (display the wanted worksheet if needed in Workbook_Open and set the status Saved of the workbook to True, in running the procedure check for that status again and hide the sheet if visible and only after that save).

    Ciao,
    Holger

  15. #15
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    Thanks for the help, but sorry you've lost me.
    So you want me to add this?
    Please Login or Register  to view this content.

  16. #16
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Hidden sheet option

    Hi, EXLent,

    never wrote nor meant that - only if no changes to the workbook had been made.

    Please Login or Register  to view this content.
    See attached workbook - I disabled the code line
    Please Login or Register  to view this content.
    in order to allow changes to the names being made. This will display the UserForm (will not if closing Workbook os active).

    Ciao,
    Holger
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    Thank for your help.
    I didn't get this part but I do now. This was what I needed to work.
    Please Login or Register  to view this content.
    Also this is what I have.
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    Ok, after I have proven that it is hidden to everyone other than the leader he still feels not secure. He wants a password protect from open/read/show. Is it possible? I know you can do it for the files, but this is for just the tab/sheet.
    Also if possible, can we have user input password without inputting it in the code? Like a popup asking for password change.

  19. #19
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Hidden sheet option

    Hi, EXLent,

    Also if possible, can we have user input password without inputting it in the code?
    You would need to put it anywhere into code (and may that only be the code to implement a module with this code via VBA).

    Like a popup asking for password change.
    No problem, I would rely on a userform for that. But you would need to store the password anywhere (as you donīt want it in the code). So maybe a Name or a CustomDocumentProperty, a text file (you would have to make sure that this file is present on any computer the workbook is opened).

    it is hidden to everyone other than the leader he still feels not secure.
    You may lock the VBA Project and secure it with a password (please keep both a version of the unprotected workbook as well as the password in a secure place). This is far from really being secure but should be good enough to protect from most users.

    Ciao,
    Holger

  20. #20
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    This is what I'm thinking. It's not correctly written tho.

    When sheet is selected, check box D100 to see if any data is in there.
    If not, ask user to add/put one.
    If yes, pop up ask user to put in password.
    Check password if it's = to one already written in the box D100.
    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    209

    Re: Hidden sheet option

    Well I got it to work exception to that the sheet shows behind the msgbox.
    How can I have it minumized before open with correct password?
    Please Login or Register  to view this content.
    Last edited by arlu1201; 07-10-2013 at 02:26 AM. Reason: Replaced html tags with code tags.

  22. #22
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Hidden sheet option

    Hi, EXLent,

    what sheet are you talking about to get that routine? Every single userīs one (who is identified by his logging into the computer)? Maybe look at this sample code and see if it helps.

    Ciao,
    Holger

+ 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