I need a formula or VBA code that will automatically lock or protect a cell once data is entered
I need a formula or VBA code that will automatically lock or protect a cell once 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
Hi superchew,
Try using below code:-
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![]()
Please Login or Register to view this content.
Regards,
DILIPandey
<click on below * if this helps>
DILIPandey, Excel rMVP
+919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com
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.
Okay.. try using below code:-
![]()
Please Login or Register to view this content.
Regards,
DILIPandey
<click on below * if this helps>
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
I did not found my code in your file.
Regards,
DILIPandey
<click on below * if this helps>
i took it out cux it didn't work, was hoping someone could squezze it in to work.
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
i have tried putting this is six different ways and it still only works for one row of cells.
Okay.. post your sample workbook .. thx
Regards,
DILIPandey
<click on below * if this helps>
Test_6(1)-2.xlsm.lnk.xlsm okay there it is thanks for any and all help.
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>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks