How to run all command with same name into a notebook

I have a very big notebook with a command repeated a lot of times but with different parameters each time and I want to run all these commands at the same time without having to run separately all of them. Is there a way?

EDIT: more info

Between different calls of the ‘command’ there are other things (mainly plots) and I want to preserve the order of the notebook.

Using the Evaluate Notebook form the menu Evaluation can be an option but when I am in a hurry this is bad because it evaluates also all the things in between while I am mainly interested in the output of my commands.




Any reason not to just merge the cells into one, or better yet, change the ‘command’ to accept arguments and then map/table over the different parameters?
– ciao
Jan 21 ’14 at 12:26



@rasher between different calls of my ‘command’ there are things and I want to preserve this ordering for formatting reasons
– Red
Jan 21 ’14 at 12:29



Ah, ok then, what about the Evaluate Notebook menu item? NVM – I missed the ‘same name’ part…
– ciao
Jan 21 ’14 at 12:34



@rasher I added more info in the question
– Red
Jan 21 ’14 at 12:41



You could mark the cells you don’t want evaluated as such in the cell menu (you can collectively do this). Otherwise, probably some notebook programming involved.
– ciao
Jan 21 ’14 at 12:43


2 Answers


As requested:

Use tags on the cells you want (same tag for all), then NotebookLocate andSelectionEvaluate together.

I get it using this code:

nb = EvaluationNotebook[];
NotebookEvaluate[nb, InsertResults -> True, EvaluationElements -> {“Tags” -> {“evaluate”}}];

and tagging with the tag evaluate only the cells that I want to evaluate on first run.