+ Reply to Thread
Results 1 to 5 of 5

Dynamic Named Range with Password Protection

  1. #1
    Registered User
    Join Date
    05-14-2019
    Location
    Cape Town, South Africa
    MS-Off Ver
    2016
    Posts
    3

    Dynamic Named Range with Password Protection

    Hi,

    I have seen similar posts but none quite fitting my specific need. My need would be better suited to a database, but alas I am stuck with excel for this one. My aim is to create a password protected column with different passwords based on a person's name in the preceding column.
    e.g. if Column B has a list of names, only that person should be able to insert info in column c for that specific row where they are referenced. I know that password protection/ user permissions can be assigned to a named range, hence I thought of creating a named range of sort. The problem is I am struggling to create a dynamic named range for column c for data that is not sequential.

    I am probably missing a simple logical trick.

    Thanks in advance.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,919

    Re: Dynamic Named Range with Password Protection

    Here is an example of what I think you want to do. Column C has a list of user ids. Column D is where you want to enter data.

    When you change selection and select a cell in column D, an "unlock" program runs. It gets the login USER ID from the Environment and compares it to the value on the same row, one column to the left. If there is no match, the sheet stays protected. If there is a match, the sheet is unprotected, the selected cell is unlocked and the sheet is re-protected. The only active cell is the selected cell.

    When the user makes an entry into this cell, the cell is then again locked.

    The Password to protect the sheet is "Password" - this is set at the top of the code in the Module Modlock. You can change it and then put a password on the VB project so people won't see the password because they won't be able to see the code.

    Here is the code on the sheet module:
    Please Login or Register  to view this content.
    Here is the code in the ModLock module
    Please Login or Register  to view this content.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    05-14-2019
    Location
    Cape Town, South Africa
    MS-Off Ver
    2016
    Posts
    3

    Re: Dynamic Named Range with Password Protection

    Thank you dflac.

    This is definitely what I was looking for . I am very much a novice at VBA - would I need to define CellRef for the range (i.e. only column C and D should remain locked and not the whole sheet)? Users should still be able to enter data on the rest of the sheet.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,919

    Re: Dynamic Named Range with Password Protection

    Here is how to "fix" your situation.

    Unprotect the sheet.
    Select all cells
    Format all cells to be unlocked.
    Format columns C & D to be locked
    Reprotect the sheet

  5. #5
    Registered User
    Join Date
    05-14-2019
    Location
    Cape Town, South Africa
    MS-Off Ver
    2016
    Posts
    3

    Re: Dynamic Named Range with Password Protection

    There really should be a facepalm emoji here. I was definitely over thinking this.

    Thanks a ton!

+ 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] E-Mail Named Range as a Password Protected Workbook
    By Bigmal70 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2017, 10:34 AM
  2. Replies: 13
    Last Post: 04-05-2017, 10:20 AM
  3. Dynamic Range protection
    By rakeshgarg1977 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-05-2016, 09:12 AM
  4. Replies: 0
    Last Post: 03-08-2016, 02:25 PM
  5. Password Protection for a range of cells in a worksheet
    By prasademany in forum Excel General
    Replies: 1
    Last Post: 11-03-2014, 05:49 AM
  6. [SOLVED] Workbook Protection - password stored in named range
    By TC1980 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-07-2013, 04:52 AM
  7. Named ranges-Should I use a dynamic named range
    By foseco in forum Excel General
    Replies: 4
    Last Post: 06-11-2009, 03:56 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