Site Map
menu 1
menu 2
menu 3
menu 4
menu 5
menu 6
 
Onsite Training
Since 2003, iCellini Computer Training has been San Diego's number one choice for onsite computer training.

How to Record and Run a Macro
Part 1: Introduction to Macros

By John Cellini
Published on August 31, 2007

If you find yourself manually performing a series of repetitive actions in Excel, you can save time by creating a macro. Technically, a macro is a VBA procedure (a group of VBA statements that performs a task or returns a result). VBA (Visual Basic for Applications) is the programming language of Excel. If you are not a VBA programmer, don't worry! If you are an Excel user, even at the beginning level, you can create a macro with Excel's Macro Recorder and Excel will write the VBA code for you. Any task that you perform with a series of keystrokes and mouse clicks can be recorded as a macro and executed as a single command.

The objective of this tutorial is to teach you how to record and run a macro. The best way to get started is to jump right in and record a simple macro. In Part 1, we will record a macro. The purpose of this exercise is to give us an overview of the steps and procedures involved in the creation of a macro. In Part 2, we discuss in detail the steps involved in recording a macro. Since you will have already created a simple macro in Part 1, you will be able to more easily understand the concepts involved in recording a macro. In Part 3, we discuss the various ways you can run a macro.

Let's get started! We will create a macro that will enter your company name and the date in a new workbook. The date will indicate when the workbook was first created and will not automatically update to the current date. Here are the steps we will follow:

Before we go any further, you should practice. Go ahead and following the steps above to enter and format your company name in A1 and enter the current date in A2. Once you are well-acquainted with the steps, proceed with the tutorial.

Open a new workbook and save it as macro_practice.xls. Open the Record Macro dialog box by clicking on the Tools menu, pointing to Macro, and then clicking on Record New Macro.

Record Macro dialog box

Before we start recording, we need to provide information about our macro. First, enter the name of the macro: CompanyName_Date. The name cannot have any spaces in it. Next, press Tab on your keyboard or click in the Shortcut key text box. Press Shift and then press C. We have just assigned a keyboard shortcut to run the macro. Store the macro in This Workbook. Finally, write a description of what the macro does. Your Record Macro dialog box should look like the above graphic. Click OK.

page 1 | 2 | next page >>