Excel Macro Definition

Use Macros to Speed up Your Routine Data Tasks

Using the Macro Development Tools in Excel
The Macro Development Tools in Excel. © Ted French

An Excel macro is a set of programming instructions stored as a procedure in Visual Basic for Applications. Macros eliminate the repetition of steps for commonly performed tasks.

These tasks include complex calculations that require the use of formulas or they might be simple formatting tasks — such as adding number formatting to new data or applying cell and worksheet formats such as borders and shading.

Other repetitive tasks for which macros can be used to save include:

  • Adding or removing rows and columns
  • Protecting or unprotecting worksheets
  • Selecting a  range of cells
  • Adding the current date to a worksheet

Triggering a Macro

Macros can be triggered by a keyboard shortcut, toolbar icon, or a button or icon added to a worksheet.

Macros vs. Templates

While using macros can be a great time saver for repetitive tasks, if you routinely add certain formatting features or content (such as headings or a company logo) to new worksheets, create and save a template file containing all such items rather than creating them anew each time you start a new worksheet.

Excel's Macro Recorder

Excel includes a built-in macro recorder that allows you to record a series of steps using keyboard and mouse that Excel then converts into VBA code for you.

The Macro Recorder is located on the Developers tab of the Ribbon.