I've got a long document and I suspect know that I mistakenly set some cell in the middle of the document to be an initialization cell, probably hidden inside multiple collapsed sections and subsections.

Is there some keyboard shortcut, menu item, or front end token that will take me to the next initialization cell in the notebook?

  • $\begingroup$ In version 11, initialization cells have a grey background. $\endgroup$
    – Szabolcs
    Jan 31, 2017 at 11:01
  • $\begingroup$ @Szabolcs I'm currently using v10, but I'm more concerned with situations where there are multiple collapsed sections and subsections and it would take a significant amount of time (including e.g. waiting for the front end to display graphics) to look for a gray background by opening and closing cell groups. $\endgroup$ Jan 31, 2017 at 11:07
  • $\begingroup$ Strongly related answer (see solution at the bottom): mathematica.stackexchange.com/a/29242/280 $\endgroup$ Oct 17, 2019 at 17:16

1 Answer 1

Select[Cells[], CurrentValue[#, InitializationCell] &]

You can use SelectionMove or just click on those objects to go there.

And here is a palette:


  "To the next initialization cell",
  With[{nb = InputNotebook[]},
    SelectionMove[nb, Next, Cell, AutoScroll -> False];
      First[SelectedCells[nb]] === Last@Cells[nb]
      CurrentValue[NotebookSelection[nb], InitializationCell]
   SelectionMove[nb, All, Cell];

  Method -> "Queued",
  FrameMargins -> 15

Your Answer

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

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