Automation --- Microsoft Excel macros

Excel macros can speed up common editing sequence and analysis you may execute in an Excel spreadsheet. The following macro automatically plots a scatter plot using data in the first two columns of the spread sheet. You may download the macro and run by double-clicking on the saved file (activityplot.xls). You will be asked to enable macros, click on yes. If you don't trust the source, follow the instructions below to record your own macro.

To run a macro, go to Tools/Macro/Macros..., a window will popup. If the macro name field is empty, you don't have any macros. If you started with activityplot.xls, you should see a macro named "activityplot", click on Run to run the macro.

Recording a macro

1. Start Excel with data. Go to Tools/Macro/Record New Macro..., a window will popup.

2. Type in a Macro name. You may also choose a shortcut key. If you typed in "r" in the shortcut key field, then Ctrl+r will run the macro.

3. A small window with a stop sign will appear. Now everything you do in the spread sheet will be recorded until you click on the stop button in this window.

4. Plot a scatter plot.

  • Select column A and B by clicking on the column label A and drag to B.
  • Click on the chart wizard to choose a plot style.
  • Choose style, format, labels as you prefer.
  • Finish. You may continue editing the plot style afterwards.
  • Stop macro recording by clicking on the stop button in the small window in step 3.

5. Delete your plot, go to Tools/Macro/Macros... and run your macro.

6. Change the data and re-run macro.