I'm writing some code that programmatically modifies the contents of the notebook it's running in. My code uses NotebookLocate
to select all the cells in the notebook that have a particular tag — in my case, they happen to be several non-adjacent Input cells (but not necessarily all input cells in the notebook). Now, I want to clear the contents of those cells, but not delete the cells themselves.
This seems to me like something that ought to be fairly easy, but I'm having a dickens of a time figuring out a way. I know I can get a list of CellObject
expressions for the selected cells by calling SelectedCells
, but is there some way to write a function I could map onto that list, which takes a CellObject
and erases its contents? Or… Ideas?