Run a Macro From the Toolbox Ribbon
Open the Exponential Data Set 2.jnb notebook and double click on the graph icon to obtain the following graph.
This is a different data set that we wish to fit.
Make sure the graph page is the current window (if it isn’t you will get an error message; more about this later).
Run the macro directly from the Toolbox button that you just set up.
The macro runs, fits the exponential function to the two data sets and places the fit lines on the graph. If the graph window is not the current window and is hidden behind the worksheet, then click on it to view it (we will make a slight modification to the macro later to improve this behavior).
You have successfully recorded a macro that will save considerable time when analyzing your data. But the macro has the limitation that you must always fit two data sets — no more, no less. To improve this you can add a for-loop in the macro to allow any number of data sets to be analyzed.