how to lock some cells in a sheet

vra

Board Regular
Joined
Apr 16, 2011
Messages
95
Office Version
  1. 2019
Platform
  1. Windows
  2. MacOS
how to lock some cells in a sheet without protecting sheet or locking sheet?I do not want to lock all cells only some cells say F5:F40, I5:I40 etc.By protecting sheet all other functions on ribbon are disabled such as font , etc
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
how to lock some cells in a sheet without protecting sheet or locking sheet?I do not want to lock all cells only some cells say F5:F40, I5:I40 etc.By protecting sheet all other functions on ribbon are disabled such as font , etc
To lock some cells, I think you would need to Protect the sheet. However, when you are protecting the sheet there are a number of options under "Allow all users of this worksheet to:" By checking some of those (eg Format Cells) you can get some more of your normal functionality.
 
Upvote 0
Your answer helped me lot. Still can i have way out that cells having formula cannot changed by anyone? If i lock cells ,protect sheet then though some features are open but still Ctrl+A, font changing of locked cells , trace dependent etc. cannot be done.
Any help will be greatly appreciable.
 
Upvote 0
Your answer helped me lot. Still can i have way out that cells having formula cannot changed by anyone? If i lock cells ,protect sheet then though some features are open but still Ctrl+A, font changing of locked cells , trace dependent etc. cannot be done.
Any help will be greatly appreciable.

Highlight the whole spredsheet and in the Font Tab in Home go to the Protection tab and uncheck Locked.

Now highlight all the cells that you would like to lock and repeat the step above this time checking the Locked option.

You can then decide what level of protection these cells have by clicking on the review tab, and then click on "Protect Sheet". Check the option that you would like depending on the different levels of protection you want for the cells. You can then apply this by clicking ok. You can password protect it prior to clicking ok by putting any password in the password option.

I thhink that this is very good and I use it quite a lot for various different functions
 
Upvote 0
my sheet is protected & now dont have any option enabled of unprotect sheet.
what to do
 
Upvote 0
Now i could unprotect my sheet , thanks!! But i did not posted my first issue correctly . Actually if i protect sheet then to change whole sheet formatting at once ctrl+a func cannot be used. Trace dependent /precedent etc cannot be used so is there solution for it so that formulaes are also not changed & above also can be done.
Thanks!!
 
Upvote 0
Actually if i protect sheet then to change whole sheet formatting at once ctrl+a func cannot be used.
When you protect the sheet, if you check the "Select locked cells" and "Format cells" boxes then you should be able to use Ctrl+A and format all cells.


Trace dependent /precedent etc cannot be used so is there solution for it so that formulaes are also not changed & above also can be done.
Thanks!!
As far as I am aware there isn't a way to trace dependents/precedents on a protected sheet.

You could see if something like this is any use. It requires the user to enable macros and is not 100% foolproof. As an example if you had formulas in C7:C22 and G7:H25 that you wanted protected you could try this code. To implement, with the sheet UNprotected ..

1. Right click the sheet name tab and choose "View Code".

2. Copy and Paste the code below into the main right hand pane that opens at step 1.

3. Close the Visual Basic window.

4. Test

<font face=Courier New><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)<br>    <SPAN style="color:#007F00">'Change line below to suit your 'protected' range(s)</SPAN><br>    <SPAN style="color:#00007F">Const</SPAN> myFormulas <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN> = "C7:C22,G7:H25"<br>    <br>    <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> Intersect(Target, Range(myFormulas)) <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br>        <SPAN style="color:#00007F">With</SPAN> Application<br>            .EnableEvents = <SPAN style="color:#00007F">False</SPAN><br>            .Undo<br>            .EnableEvents = <SPAN style="color:#00007F">True</SPAN><br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br>        MsgBox "Cannot change cells in " & myFormulas<br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,845
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top