+ Reply to Thread
Results 1 to 5 of 5

VBA code to unlock select cells

Hybrid View

  1. #1
    Registered User
    Join Date
    10-22-2012
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2002 + 2010 + MAC 2010
    Posts
    15

    VBA code to unlock select cells

    Hi All

    On the attached document each column has been set up so that only entries can be input by the user and they are protected once entered so that no one (a general user) can delete them. It has also been set to limit the entries to 8 on each column (cells 9 to 28).

    i have tried to construct a vba routine so that the sheet owner can cancel any of the entries and if the limit of 8 was met it will remove the protection on the cells which are blank, but keep the protection on those which have data in.

    Any help on the routine( which does not always work) to either fix or simplify is appreciated.

    Thanks

    Chris
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,894

    Re: VBA code to unlock select cells

    Hello Christopher. Open the attached file. I have protected it with the password as "password". Unprotect the file and protect it again with a password of your choice. Then right click the sheet tab and click 'View Code'. Change "password" to the password that you chose (3 occurrences). Next open the code window for Module3 and replace "password" to your password (1 occurrence). Now you can enter your data in the worksheet as usual. If the sheet owner wants to make changes, he/she clicks the 'Allow Access' button and will be prompted for the password. Obviously, only the sheet owner will have the password. Nobody else will be able to make any changes. Let me know if it works the way you wanted.
    Attached Files Attached Files

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,894

    Re: VBA code to unlock select cells

    My apologies Christopher. There was a small error in the cell protection in the previous file. Please try this one.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-22-2012
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2002 + 2010 + MAC 2010
    Posts
    15

    Re: VBA code to unlock select cells

    that looks good thanks for you help.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,894

    Re: VBA code to unlock select cells

    My pleasure.

+ 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