As suggested in this earlier post, I restate my question here about appending CellTags option to existing list of Cells.

What I have for the moment:

listOef = {};

SelectionMove[this, Before, Notebook];
SelectionMove[this, Next, Cell];
SelectionMove[this, Next, Cell];
  SelectionMove[this, Next, CellGroup];
  AppendTo[listOef, NotebookRead[this]]
  , {i, aantalVragen}]

This copies cells I give in the EvaluationNotebook[] to the list listOef.

I now want to write this list to the new notebook nb after permuting its elements randomly with

allPermutations = Table[RandomPermutation[aantalVragen], {aantalToetsen}];

like this:

    Permute[listOef, allPermutations[[toetsNummer]]][[vraagNummer]]];
 {vraagNummer, aantalVragen}]

In this Do[] command, I would like to add Labels to every cell during the NotebookWrite command: its label would be "vraagNummer", the counter which goes from 1 to aantalVragen, which is given at the beginning of the document.

I'd like to have something like this:

SetOptions[ Cell, CellLabel->"vraag"<>ToString[vraagNummer] ]

but this doesn't seem to work. How can I address the cell which has just been written by NotebookWrite? Or how would you suggest to do this using this structure?

Thanks for all help!


1 Answer 1


I've found the answer for this question:


gives the selected region of notebook nb. So using

  CellLabel -> "Vraag " <> ToString[vraagNummer] <> "."];

this can indeed change the CellLabel after writing the cell.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.