+ Reply to Thread
Results 1 to 15 of 15

Enter Value in Cell - Unlocks Entire Row

  1. #1
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Enter Value in Cell - Unlocks Entire Row

    Hi,

    Can I enter a value into column A (any row) that would unlock the entire row whilst leaving the rest of the sheet protected?

    Example - in A51 I would enter "Z" and that would unlock the row.

    Thanks
    Regards
    Chris
    Last edited by zimbo109; 03-04-2010 at 08:11 PM.

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Enter Value in Cell - Unlocks Entire Row

    Yes can be done with VBA. Not by formula. Want to go in that direction?
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Enter Value in Cell - Unlocks Entire Row

    Yes please, I am familiar with VBA - but just need to know step by step of where to enter it ect.

    Many thanks
    Regards
    Chris

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Enter Value in Cell - Unlocks Entire Row

    here's a start
    Please Login or Register  to view this content.
    Make all A1:A100 UNLOCKED (format cells protection)
    Make B1:B100 LOCKED (format cells protection)

    Put this code the the Sheet's code (right click TAB and view code)

    Note that this will UNLOCK any row when you type z in that column. It does not change back (yet)

    Hope you can manage, otherwise ... we'll be here.
    Last edited by rwgrietveld; 03-04-2010 at 11:06 AM.

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

    Re: Enter Value in Cell - Unlocks Entire Row

    Quote Originally Posted by rwgrietveld View Post
    Yes can be done with VBA. Not by formula. Want to go in that direction?
    Heh...that's probably why this Q is in the programming forum.

    Zimbo,

    1) Right-click the sheet tab and select VIEW CODE
    2) Paste in these sheet-event macros.

    The first will protect the sheet again when it is activated (brought up onscreen) but also set the flag that allows macros to change the protected worksheet even though it's protected. Edit the password.

    The second is the macro that unlocks a row if "Z" is put in column A anywhere.
    Please Login or Register  to view this content.

    3) Close the editor
    4) Save the workbook as a macro-enabled workbook
    5) Switch to a different sheet, then come back...this triggers the first macro silently
    6) You can now enter a Z in column A and the rest of the row will unlock.

    This requires that you previously unlocked column A before the sheet was protected.
    _________________
    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!)

  6. #6
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Enter Value in Cell - Unlocks Entire Row

    Go for JB's solution. It's more elegent as it includes
    1) UserInterfaceOnly
    2) It extends over the full range of column A and
    3) If you Ctrl+Enter "Z" values in a few cells (in column A), JB's function will do them all.

  7. #7
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Enter Value in Cell - Unlocks Entire Row

    Works great - big thanks to both,
    Is there a way to re lock the row if the Z is removed from column A ?

    Regards
    Chris

  8. #8
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Enter Value in Cell - Unlocks Entire Row

    Hi,

    Just noticed after inserting your code JB that I can no longer insert rows into the sheet?
    Regards
    Chris

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

    Re: Enter Value in Cell - Unlocks Entire Row

    Like so:
    Please Login or Register  to view this content.


    If you want to continue tweaking what is allowed and what is not on your protected sheet, turn on the macro recorder and let it record you protecting a sheet and setting all the flags the way you want them. Then look at that code to spot the items you need to add/subtract from the code.
    Last edited by JBeaucaire; 03-04-2010 at 01:45 PM. Reason: corrections in cell vs. target

  10. #10
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Enter Value in Cell - Unlocks Entire Row

    Yep this works fine - Thank you for your help - once again!

    Regards
    Chris

  11. #11
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Enter Value in Cell - Unlocks Entire Row

    Sorry! would it be possible to add to your above code so that: we have column A with a "Z" to unlock the entire row (current code) but also to include that column "Q" when PC is entered it also unlocks the entire row?

    Thanks
    Chris

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

    Re: Enter Value in Cell - Unlocks Entire Row

    I assume this means that column Q has to be left unlocked when the row locks again, yes?

    Please Login or Register  to view this content.

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

    Re: Enter Value in Cell - Unlocks Entire Row

    When you decide you need another expansion to this macro, take a look at the macro you have been given so far and try to adjust it yourself. Post up your attempt so I can help you work through it.

    If you understand what the code is doing, you can learn and maintain it on your own, yes?

  14. #14
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Enter Value in Cell - Unlocks Entire Row

    Yes -will do, thanks again for your help - I can adjust the code to suit by playing around with it - up until a few weeks ago I had no idea of VBA ect!!!

    Thanks
    Chris

  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: Enter Value in Cell - Unlocks Entire Row

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated. It is found across from the "time" in each of our posts.)

+ 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