+ Reply to Thread
Results 1 to 16 of 16

Passwords and drop down lists

  1. #1
    Registered User
    Join Date
    05-21-2008
    Posts
    45

    Red face Passwords and drop down lists

    How would I write a marco that requires a password when a certain word in a drop down list is selected, bearing in mind that when this word is selected certain cells in the worksheet are no longer locked - in other words the certain cell can only changed by a specific person in the drop down list which when this person is selected a password is required.

    Hope that made sense.

    Many thanks

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Passwords and drop down lists

    SO, all that you want to happen is that when "John Doe" is selected in a certain cell, the sheet immediately asks you for a password. If the password entered is correct, it allows "John Doe" to be selected and does nothing else.

    If the wrong password is selected, in indicates "wrong password" and removes the name "John Doe" from the cell.

    Is that all? What's the cell?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Passwords and drop down lists

    What kind of drop down box are you using?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    05-21-2008
    Posts
    45

    Re: Passwords and drop down lists

    I am using a validation drop down list. When a certain name is selected from the list I need a password prompt. once the person enters the correct password certain cells should be free for editing - with the other names in the drop down list the sheet should remain locked ( apart from the cells they are allowed to edit ) - in other words the person that is password protected has more acress rights and can edit an extra cell.

    Many thanks

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Passwords and drop down lists

    I would create Named Ranges based on the names in the list that can be locked or unlocked as required, then use the worksheet_change event. If you need help with this then attach an example workbook

  6. #6
    Registered User
    Join Date
    05-21-2008
    Posts
    45

    Red face Re: Passwords and drop down lists

    Many thanks
    Attached Files Attached Files

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Passwords and drop down lists

    I've added two named ranges - Bob & Claire.

    The code unlocks the selected range if the password is correct. Selecting a cell out of that range relocks the cells

    look at the code for the passwords.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-21-2008
    Posts
    45

    Unhappy Re: Passwords and drop down lists

    Thank you very much, but is the password secret, because I cant seem to get it to work.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Passwords and drop down lists

    The passwords are in the code.

    The sheet password is secret
    Bob is x
    Claire is y

  10. #10
    Registered User
    Join Date
    05-21-2008
    Posts
    45

    Re: Passwords and drop down lists

    I get a runtime 1004 error

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Passwords and drop down lists

    It works for me. I've only added Bob & Claire.

    What exactly are you doing? When you select the name in the yellow cell your are prompted for a password - Bob is x. You can then edit Bob's cells. When you select a different cell not in Bob's cells the cells are locked again

  12. #12
    Registered User
    Join Date
    05-21-2008
    Posts
    45

    Re: Passwords and drop down lists

    Ok it works now, is there a way to change or get rid of the error message that comes up when you try to edit a cell

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Passwords and drop down lists

    Quote Originally Posted by NatNat View Post
    Ok it works now, is there a way to change or get rid of the error message that comes up when you try to edit a cell
    Do you mean the one that tells you that the sheet is protected? That is an inbuilt Excel message. You can stop it by using
    Please Login or Register  to view this content.
    I wouldn't bother though because you will need to reset it.

  14. #14
    Registered User
    Join Date
    05-21-2008
    Posts
    45

    Re: Passwords and drop down lists

    Where would I put
    Application.DisplayAlerts = True
    In the code

  15. #15
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Passwords and drop down lists

    Near the very top is where I put all my declarations (DIM) and Application.Whatever code.

  16. #16
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Passwords and drop down lists

    Application.DisplayAlerts will not stop that error message

+ 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