Is there a way to "lock" some cells in a notebook so they can't be edited? It's usually input cell that's documenting some functionality. I'd like other readers of the notebook to be able to execute them but not changing them.
Asked
Active
Viewed 1.1k times
2 Answers
10
Suppose you have an open notebook, say "Untitled-1". The following code, executed in the same notebook or another, will select all the Input cells and set them to un-Editable and un-Evaluatable.
nb = First[Notebooks["Untitled-1"]];
inputCells = NotebookFind[nb,
"Input", All, CellStyle];
SetOptions[inputCells,
Evaluatable -> False,
Editable -> False]
Mark McClure
- 32,469
- 3
- 103
- 161
10
If you want to make some cell non editable, mark these cells and use the menu entry
Cell -> CellProperties
and remove the mark before Editable.
If your cell is an Input-Cell, it can be evaluated but not edited.
Peter Breitfeld
- 5,182
- 1
- 24
- 32
-
2For extra protection, before making the cell not
Editable, you may wish to make it notDeletable. To do so, select the cell, open the Option Inspector, and uncheckDeletablein theCell Options > General Propertiessection. (And while you're there you can then also uncheckEditable.) – murray Nov 01 '12 at 20:30 -
-
And as I learned when I first tried it, you must make a cell non-
Deletablebefore you make it non-Editable! – murray Nov 02 '12 at 13:45
Editablealready? – J. M.'s missing motivation Oct 31 '12 at 16:39