Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a simple way to expand multiple cells simultaneously?

At the moment I am primarily interested in fully expanding "in one fell swoop" all the cells in a documentation window, although I can imagine situations in which I'd want to open several cells only one-level deep, so I'm interested in this case as well. Finally, it would also be useful to know how to collapse multiple cells at once.

EDIT: My immediate interest is for ways to do this interactively, rather than programmatically. I.e. keyboard (+ mouse) shortcuts, or (second best), menu commands.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

There are a range of commands that allow you to programmatically control the front end. For example

FrontEndExecute[{FrontEndToken[InputNotebook[], "SelectAll"]}];
FrontEndExecute[{FrontEndToken[InputNotebook[], "SelectionOpenAllGroups"]}];

selects all the cells and opens them.

NotebookFind[InputNotebook[], "Output", All, CellStyle];
FrontEndExecute[FrontEndToken[InputNotebook[], "SelectionCloseUnselectedCells"]];

May also be of use. The places to look for help about these kind of commands is FrontEndToken and the tutorial or this help page.

share|improve this answer
Bill, you missed a couple o'spaces :) –  Sektor Sep 20 '13 at 16:04
Thanks! I was actually looking for interactive commands (though I did not make that very clear in my original post). Your answer, however, gave me enough to search with. I found what I was looking for (namely, Ctrl + {) under Cell > Grouping. –  kjo Sep 20 '13 at 19:34

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.