+ Reply to Thread
Results 1 to 7 of 7

Lock an entire row

  1. #1
    Registered User
    Join Date
    04-19-2012
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2010
    Posts
    18

    Lock an entire row

    Currently I have this code, but it's not working. I'm not sure what to use to lock an entire row. Seems like this would do it.

    Please Login or Register  to view this content.
    Last edited by kid_epicurus; 04-19-2012 at 04:27 PM.

  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: Lock an entire row

    How about this:


    Please Login or Register  to view this content.
    _________________
    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
    Registered User
    Join Date
    04-19-2012
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Lock an entire row

    I'm still able to make edits to the row using that code. :/

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Lock an entire row

    Maybe it's objecting to the Value = True part

    See if this works
    Please Login or Register  to view this content.
    Last edited by arlu1201; 04-21-2012 at 02:22 PM. Reason: Use code tags.

  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: Lock an entire row

    No, the code I gave is correct. I'm going to guess he hasn't PROTECTED his worksheet yet. The Locked = True/False setting only "applies" when you protect your worksheet.

    If you're going to have macros making changes to your protected worksheets, you'll have to specifically unprotect and reprotect, too.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-19-2012
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Lock an entire row

    Ah ok. Didn't know worksheets had to be protected in order to lock/unlock rows. Weird.

    Seems like they'd have an option to just lock a row without having an entire workbook protected. Especially since I just need to lock down one row at a time and don't need the entire workbook locked down.

    Thanks!

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

    Re: Lock an entire row

    Nah, not weird at all. And you do have the option to lock just a row and not the entire sheet (not workbook, just the sheet). If you first set all the cells on a sheet to UNLOCKED, the specifically set the rows to locked that you want, when you then lock the sheet.... those are the only cells locked.

    You do understand that there has to be a state in which no cells are locked... think of it as Design Mode, then you flip the switch to activate the locks on appropriate cells all at once. That's why it works this way.

    And there is a difference between a sheet being protected and an entire workbook being protected, too.


    If that takes care of your need, please click Thread Tools above your first post and mark this thread as SOLVED.

+ 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