To Create Macros in Excel

A serious study of macros in Excel is way beyond this page. But for mathematically and computer oriented students, macros form a great way to start to take control of the computer. They are written in Visual Basic, with a few additions to work in Excel. A few comments to get the experiential learners started:

Big picture

1) create a new macro
2) create a button and link it to the button
3) edit / add to the macro
4) examine the help menus

First, find how to record a macro, view the code, and create a button to control it in your version of Excel. Then skip to the 'Universal' instructions below.

Excel 2003 - Windows and 2004 - Macintosh

From the Tools menu, select Record New Macro. Click on the floating button to stop. To create your own button, the simplest is to Copy / Paste from an existing spreadsheet that has one. To create a new one, from the View menu, select Toolbars / Forms. Click on the Button.

Excel 2007 - Windows

From the Developer tab, select Record Macro. To stop, click on Stop Recording, also found in the Developer tab. To create your own button, you can Copy / Paste from an existing spreadsheet that has one or to create a new one, from the Developer tab / Controls section, select Insert and choose the button from the top Form Controls portion.

Excel 2008 - Macs

Not supported by Microsoft.

Universal Instructions

To make your first macro, add some data to your spreadsheet and then Record New Macro. Select some task such as sorting a column of data, clearing a column, changing cell format, etc. Then stop recording and view what you created. Link it to your button and then start programming! Note that there are extensive Help Files available. Traditional Visual Basic Loops, If...Then statements, Functions, etc. work just as one would expect. You can use cells instead of variables and store and change data within them. As you gain confidence, try recording a macro that opens a new file or saves one as a text file, or creates a graph or drawing shape. Experiment!

Return to Macros in Excel page