+ Reply to Thread
Results 1 to 13 of 13

automatically lock cells when data is entered

  1. #1
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    automatically lock cells when data is entered

    I need a formula or VBA code that will automatically lock or protect a cell once data is entered

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,598

    Re: automatically lock cells when data is entered

    Google returns :
    http://www.ozgrid.com/forum/showthread.php?t=161591
    http://www.pcreview.co.uk/forums/loc...-t3285195.html

    and many others

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: automatically lock cells when data is entered

    Hi superchew,

    Try using below code:-

    Please Login or Register  to view this content.
    To use this code, press alt + F11 from excel window and look for desired sheet name in left side of new window. Double click on sheet name and paste this code on right side pane.. done


    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  4. #4
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: automatically lock cells when data is entered

    This kinda works only issue is when i enter data into on cell in the range it locks them all. I all cells available until data is entered.

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: automatically lock cells when data is entered

    Okay.. try using below code:-

    Please Login or Register  to view this content.

    Regards,
    DILIPandey
    <click on below * if this helps>

  6. #6
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: automatically lock cells when data is entered

    heres the new issue it will lock first set of cells when i hit start and stop but then it stops working. I have attached copy of sheet to hopefully help what i want it to do is when start and stop are hit it enters the data (which it currently does fine. and than locks just those cells Test 6.xlsm

  7. #7
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: automatically lock cells when data is entered

    I did not found my code in your file.



    Regards,
    DILIPandey
    <click on below * if this helps>

  8. #8
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: automatically lock cells when data is entered

    i took it out cux it didn't work, was hoping someone could squezze it in to work.

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: automatically lock cells when data is entered

    Your issue is that Excel defaults to all cells in the sheet being locked. You want them to all be unlocked (I'd rethink this and just set certain ranges where people are supposed to enter data to be unlocked).
    To unlock all cells, select the entire sheet (right click on the square between vertical and horizontal labels) > Format Cells> Protection> Uncheck "Locked"

    If you want to just unlock certain cells (ie G5:M31) just select those cells.

    Now dilipandey's code should work.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  10. #10
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: automatically lock cells when data is entered

    i have tried putting this is six different ways and it still only works for one row of cells.

  11. #11
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: automatically lock cells when data is entered

    Okay.. post your sample workbook .. thx



    Regards,
    DILIPandey
    <click on below * if this helps>

  12. #12
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: automatically lock cells when data is entered

    Test_6(1)-2.xlsm.lnk.xlsm okay there it is thanks for any and all help.

  13. #13
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: automatically lock cells when data is entered

    Okay.. see the attached file which will help you in your query
    "automatically lock cells when data is entered "

    Test_6(1)-2.xlsm.lnk.xlsm

    Regards,
    DILIPandey
    <click on below * if this helps>

+ 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