+ Reply to Thread
Results 1 to 13 of 13

Password protecting 8 sheets so other users can only view their own sheet

  1. #1
    Registered User
    Join Date
    10-13-2014
    Location
    Phoenix, AZ
    MS-Off Ver
    2010
    Posts
    99

    Password protecting 8 sheets so other users can only view their own sheet

    Hello, I know I can right click on a sheet and select "Protect sheet" but I need to do more. I need to make it so the users cannot see sheets to which they should not have access. I have eight users who will each need to open a spreadsheet, view common areas, then enter a password so they can view their own user info on their sheet. How do I do this? I am not a programmer. Thank you in advance

  2. #2
    Registered User
    Join Date
    10-14-2014
    Location
    Plano, TX
    MS-Off Ver
    2010
    Posts
    2

    Re: Password protecting 8 sheets so other users can only view their own sheet

    Is this what you are looking to do?
    http://office.microsoft.com/en-us/ex...010078580.aspx

    Also.. you don't have to be a programmer to learn some basic formulas and such. There is a wealth of free knowledge out there.
    Here are a couple resources for Free Microsoft Excel Tutorials.
    Hope the link helped !


    http://learningcomputer.com/microsof...xcel-2013.html

    https://www.youtube.com/watch?v=luW9O_ee3lg

  3. #3
    Registered User
    Join Date
    10-13-2014
    Location
    Phoenix, AZ
    MS-Off Ver
    2010
    Posts
    99

    Re: Password protecting 8 sheets so other users can only view their own sheet

    Thank you for the links at the bottom. The first link is not what I need. I know how to protect a sheet from being edited. What I needed was to give users to only the sheets for which they have a password entered correctly. I found this piece of code online and I'm using it successfully:

    Here is one way to do as you wish. This does not hide the entire sheet, but scrolls down 1000 rows to a point that you probably do not have data in. Copy the following event handler to the clipboard:

    Private Sub Worksheet_Activate()
    ActiveWindow.ScrollRow = 1000
    pWord = InputBox("Enter password to view the worksheet", "Secure Area")
    Select Case pWord
    Case Is = "password" <- Enter your own password
    ActiveWindow.ScrollRow = 1
    Case Else
    Sheets("Sheet1").Activate <- Enter your sheet name instead of Sheet1
    End Select
    End Sub

    Select Sheet2 and right click the sheet tab.

    Select 'View Code'

    Paste the event handler into the editing area to the right.

    Close the VBE and return to the worksheet.

    Select 'Sheet1'. Reselect Sheet2 and you will be prompted for the password. The correct password will set the scrollrow to 1, otherwise Sheet1 will be reactivated.

    If you wish to use a different password, change "password" in line 5 to your preferred password, i.e. "magnoliathunderkitty".


    My next problem is this: The passwords work well but when the users open the sheet, if they don't select to enable content, they can view all of the tabs. That would be bad! I now need to remove the enable content bar while at the same time still enabling the VBA code/macros. How do I do this?

  4. #4
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Password protecting 8 sheets so other users can only view their own sheet

    Here is a solution I cam up with, see the attached below.

    The Code for the module is:
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

    The Passwords sheet is hidden. You'll need to unlock the workbook to unhide it so you can customize it. The password for everything is "MyPassword". You'll want to change that. You'll also want to password protect the VBA project. To do that go to the VBA editor and right-click on any module within the worksheet and select "VBA Project Properties" and supply a password in the "Protection" tab.
    Last edited by Whizbang; 10-15-2014 at 12:20 PM.

  5. #5
    Registered User
    Join Date
    10-13-2014
    Location
    Phoenix, AZ
    MS-Off Ver
    2010
    Posts
    99

    Re: Password protecting 8 sheets so other users can only view their own sheet

    Wow! That's a lot of stuff. Thank you. I'll work on it shortly and let you know how it goes. Thanks again

  6. #6
    Registered User
    Join Date
    10-13-2014
    Location
    Phoenix, AZ
    MS-Off Ver
    2010
    Posts
    99

    Re: Password protecting 8 sheets so other users can only view their own sheet

    OK, Im pretty confused. I have a piece of VB code already which asks for a password for each sheet. That's working fine. It looks like your VB code hides all of the sheets except a "Welcome To" screen which asks for a password. Name Password
    Amy Wagner
    Chad Augu87
    David donkey
    Danielle Peanut1
    Brianna Everly
    Rachel bubble
    Jim Jim6641
    Liz LIZZYG
    Master sheet Master


    These are my employee names (and consequently) the worksheet names and their corresponding passwords. I like your piece of code which locks the workbook and ties a password to it -> ActiveWorkbook.Protect Password:="MyPassword". How can I add that to my spreadsheet? Also, do I need to add your long piece of code to each of my employee named sheets? Im not a programmer

  7. #7
    Registered User
    Join Date
    10-13-2014
    Location
    Phoenix, AZ
    MS-Off Ver
    2010
    Posts
    99

    Re: Password protecting 8 sheets so other users can only view their own sheet

    OK, I figured out how to password protect the sheet. I don't need the password pieces since I already have that. Which pieces of your code present the "welcome to" screen and hide all of the other screens until the right password is entered?

  8. #8
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Password protecting 8 sheets so other users can only view their own sheet

    You only need to insert the code above into a new module:

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    My code uses a common password for all sheets. You would need to modify it if each sheet has a different password.

    To get my code as-is to function in your workbook:

    1: Insert a new worksheet and name it "Passwords" or copy the sheet from my workbook into your own
    2: Enter your sheetnames and passwords as you provided above into columns A and B of the Passwords sheet.
    3: Insert a new sheet and name it "Master" or Copy the sheet from my workbook into your own. (You will have to change the Data Validation for the User field to accommodate your list of users.)
    4: Copy the code above into a VBE module, as detailed in the instructions above.
    5: Unprotect all sheets and the workbook.
    6: Run the "HideWorksheets" macro to hide and protect all sheets except the master.

    Now all sheets are hidden by default and selecting a user and entering a correct password will display the selected sheet.

    You may also want to put in a line in your workbook on-close event that runs HideWorksheets to clean up from the last user. Once you get the rest up and running to your satisfaction, I will walk you through that part.

  9. #9
    Registered User
    Join Date
    10-13-2014
    Location
    Phoenix, AZ
    MS-Off Ver
    2010
    Posts
    99

    Re: Password protecting 8 sheets so other users can only view their own sheet

    OK, Ive added the new module but I'm pretty sure I've messed it up. I've attached it here. Can you take a look at it? I have a piece of VB code on each sheet which I probably need to remove since Im trying to use your welcome to screen idea. Ive password protected the workbook with password Master. Can you tell me what I have wrong? Oh, also, the first three sheets after the welcome screen tab, called Calls Common area, Claims Common area, and Charts should all be open access to everyone at all times. How do I achieve that?

    Thanks again for your help
    Attached Files Attached Files

  10. #10
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Password protecting 8 sheets so other users can only view their own sheet

    I updated your workbook to work. See attached.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    10-13-2014
    Location
    Phoenix, AZ
    MS-Off Ver
    2010
    Posts
    99

    Re: Password protecting 8 sheets so other users can only view their own sheet

    Thank you again

    Two questions: 1) The sheet named Amy is visible, how do I fix? and 2) I get the following error message when I run the password. See attached
    Attached Images Attached Images

  12. #12
    Registered User
    Join Date
    10-13-2014
    Location
    Phoenix, AZ
    MS-Off Ver
    2010
    Posts
    99

    Re: Password protecting 8 sheets so other users can only view their own sheet

    OK, I enabled macros and that fixed the error message. How do I hide Amy's sheet?

  13. #13
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Password protecting 8 sheets so other users can only view their own sheet

    Run the macro "HideWorksheets". It should hide it. Sorry. I didn't realize I had left it visible when I uploaded it.

+ 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. Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  2. Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  3. Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  4. Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. Replies: 2
    Last Post: 06-28-2005, 01:05 AM

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