I can count how many cells there are in a notebook up to and including the one whose ID i need, and then evaluate Cells[EvaluationNotebook[]][[number, 1]].

How to do this simpler? And how to get a list of cell IDs when a number of cells are selected?

  • $\begingroup$ CurrentValue[#, CellID] & /@ SelectedCells[InputNotebook[]] is this what you want? $\endgroup$ – Kuba Feb 19 '18 at 12:32
  • $\begingroup$ @Kuba Thank you Dynamic[SelectedCells[EvaluationNotebook[]][[All, 1]], UpdateInterval -> 1] works. I get ID number 4929, but confusingly CurrentValue[CellObject[4929], "CellID"] evaluates to 0. $\endgroup$ – MeMyselfI Feb 19 '18 at 12:46
  • 2
    $\begingroup$ CellID option and CellObject's id are not the same thing. It would be good to know what do you want at the end. $\endgroup$ – Kuba Feb 19 '18 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.