Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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