+ Reply to Thread
Results 1 to 17 of 17

Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sheet.

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sheet.

    Dear Forum,

    I need to Hide Multiple Sheets in a Workbook as this common file would be sent to every Location and I want to provide different recipients different password to open each sheet.

    I would like to create a list of passwords and then all the Sheets except the Sheet where the passwords are stored get closed and would only open when the user enters the correct password.

    When the user tries to open the sheet it should provide an Input Box to capture the password...

    I need to have different passwords for each different sheet as each sheet would be named as per the Region.

    Ex: MainSheet\Mumbai\Delhi\Bangalore

    Lets say my Password for Mumbai - "Mum2018457", Delhi- "Del2018754" and Bangalore- "Ban2018574"

    So I have a Range of Sheet Names in the Col A and the passwords in Col B
    Col A----------Col B
    SheetNames--Passwords
    Mumbai------ "Mum2018457"
    Delhi--------- "Del2018754"
    Bangalore--- "Ban2018574"

    Found a few codes but unable to use them..

    Regards
    e4excel

  2. #2
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,256

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    Try this i am figure your name sheet and pasword in sheet1 change is needed
    Please Login or Register  to view this content.
    "ThankyouFor Attention * And Your Help!!"

  3. #3
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    i coded this differently than daboho, if his doesn't work, then give mine a try.

    here is the code for Module1
    Please Login or Register  to view this content.
    and here is the code for Userform1
    Please Login or Register  to view this content.
    here is the code for Mainsheet
    Please Login or Register  to view this content.
    and here is the code for ThisWorkbook
    Please Login or Register  to view this content.
    ive attached a sample file, see if this works to your liking. still have one issue to overcome though (it pops up the last password instead of initializing it) FIXED!!
    Attached Files Attached Files
    Last edited by dmcgov; 11-30-2018 at 02:44 PM. Reason: reset textbox1.value

  4. #4
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    one last thing, there is a hidden sheet (called hdn_Codes) that can show the sheet with the user Master and password is Password. that way you can manage your passwords on the sheet.

  5. #5
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    Thanks dmcgov....You have done a wonderful job, however it gets UnHidden with normal way as well....
    So please do that small bit of coding to prevent it from getting UnHidden it should not be actually shown in the list to unHide

  6. #6
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    Dear Dabho,
    Thanks for your help but I am getting an error in the line If .exists...

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    ok i fixed the hidden sheet issue. below is the workbook. note that the VBA password is "password", you will want to protect the code so that someone can't write code to show the sheets.

    i am working on a password hashing macro so that the passwords are not exposed in cleartext.

    let me know if you need anything else.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    Thanks once again but can you please put the Focus back on the Successful Password Sheet..Example if I out the correct password thee Focus should go in the Cell A1 of Mumbai..Please do work on that hashcode..and I would have more than 32 Sheets so is there a way I can write a loop..

    Please can you please explain your code so that I can tweak it a bit.. Thanks once again

  9. #9
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    i never removed the setfocus, it still is in the button code for the userform. it should ask you for a city, then type in master, this should open the password textbox and the focus should be on the textbox so that all you have to do is type and it should show up.

    so you have more than 32 sheets, do you have a list of the cities in a range perhaps?

    all of module 1 is for showing the userform and resetting the textstring to ""
    for the userforms, the first button if for the OK which passes the password, the second is cancel which just a way of closing the form
    the code for mainsheet is where you would add cities
    and ThisWorkbook is where you veryhide the sheets.

    so for you adding code, just add all your cities (since you have more that 26 cities, you wont be able to use character1 for the code, so use two or three shortcodes for the cities (like MUMbai or BAngledesh) that should get you going. if you need moreof my help, just upload what you have and i will work with that.

    note still working on the hashcode, its tricky.

  10. #10
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    got the hashcode working but i have some questions for you. are you still planning on using this solution?

  11. #11
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    óf course I am preety impressed with your helping nature and your code..
    I was mentioning the Set Focus on password successful entry. I need to go that Sheet which gets Unhidden..
    I have a list of 32 Sheets with any password which you choose..

  12. #12
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    please upload a list of cities (any format is good). i will use that to create a loop of the cities.

  13. #13
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    Thanks... but you can make an example of any four cities in a loop..i will tweak as im at home do not h ave the list now

  14. #14
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    well, i can see where this would be cumbersome with 32 cities. so on MainSheet, i have a button to unhide the cities by password. below is the line.

    Please Login or Register  to view this content.
    if i create a loop instead of an inputbox, then your users will have to cycle though each city to find the one that is theirs which could mean answering No 31 times (if their city was last) so i think its better to have the inputbox. rather than list 32 cities, i can simply change the inputbox to
    Please Login or Register  to view this content.
    so that they type in the city to the inputbox. the other way (more cumbersome) is to create a userform (but again with 32 cities, that would crowd the form. not sure i would want to do that.

  15. #15
    Registered User
    Join Date
    11-03-2008
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    2,521

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    I think that a Single Input Box to any city would be great

  16. #16
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    ok, i can do that easy peasy. when you get to work (or wherever), send me a list of the cities so that i can code them for the inputbox.

    here is a sample of what that would look like.

    Please Login or Register  to view this content.
    so i would code an ElseIf for each city. no loop.

  17. #17
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Hide/UnHide Multiple Sheets with different passwords for each Sheet except the Main Sh

    so i have the password portion of the macro working. so this is good to go (For testing purposes), note that i still need a list of your cities to finish the project.
    Attached Files Attached Files

+ 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] VBA to hide all sheetson workbook open, but then unhide sheets where sheet name matches en
    By scotlandsneo in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 05-26-2015, 02:00 PM
  2. [SOLVED] Hide and Unhide rows on multiple sheets based on a validation list on a single sheet
    By bbarth in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-30-2015, 02:10 PM
  3. [SOLVED] Hide/Unhide sheets based on text result of IF Formula in cell in another sheet
    By yukinosei in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-16-2014, 01:17 PM
  4. Hide/Unhide rows on multiple sheets when dropdown selected from sheet 1
    By tammhelp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-02-2012, 10:33 PM
  5. [SOLVED] Hide excel sheets but visible after clicking on hyperlink from main sheet.
    By naveen4pundir in forum Excel General
    Replies: 2
    Last Post: 03-29-2012, 02:16 AM
  6. Hide/unhide sheets based on user names and passwords
    By rama1209 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2011, 09:11 PM
  7. Capture cells from one sheet into another. Hide/Unhide Sheets
    By jj72uk in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-12-2009, 08:28 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