Office 2010 - Excel

Lesson 85: “Macros”

85/87 Lessons 

What are “Macros”

“Macros”are small programs used to carry out repetitive tasks automatically. A “Macro” performs actions we normally do on our keyboard and stores them as a Visual Basic program. Once defined, we can run a “Macro” by pushing one button for the whole series of actions which we previously programmed.

Suppose we want our company name, address and phone number in the left corner on every sheet of our “Workbook”.

When we include all these actions in a “Macro”, we can eliminate having to define the same actions again and again by running the “Macro” to automatically repeat.

 

Record “Macro”

In order to record a “Macro”, click the “Macro” button in the “View” tab and select “Record Macro” from the drop-down menu.

This opens the “Record Macro” dialog box.

In the upper section we give a name for our “Macro”.

In the next section we give a possible shortcut to run our “Macro” from the keyboard. Make sure you do not overwrite an existing shortcut.

In the third section we determine where we want to save our “Macro”. If you select “This Workbook”, the “Macro” is available only in the current “Workbook”.

If you choose “Personal Macro Workbook”, the “Macro” is available to all files that we create in “Excel”.

Optionally, you can give a description in the last box.

Click the OK button.

 

Next we need to record every action we want to perform in the “Worksheet” and include them in the “Macro”.

When you’re done, click the “Stop Recording” button, found in the status bar at the bottom or click the “Macros” button “in the “View “tab, and select “Stop Recording ” from the drop-down menu.

 

 

“Macro”

To run a recorded “Macro”, click the “Macro” button in the ” View “tab, and select” View Macros “.

In the dialog that appears, select the “Macro” you just created, and click the “Run” button.

 

 

 

 

 

 

“Macro” Editing

To modify a “Macro”, click the “Macro” button “in the” View “tab, and select ” View Macros”.

In the dialog that appears, select the “Macro” you wish to modify and click the “Edit” button.

This opens the “Microsoft Visual Basic” application.

The “Macro” name is at the top of the “Macro” code.

You can make changes in the code itself, assuming you know “Visual Basic”

If that is not the case you better close the window by clicking the X at the top right.

 

Remove a “Macro”

To delete a “Macro”, click the “Macro” button in the ” View “tab and select “View Macros”.

In the dialog that appears, select the “Macro” you wish to delete, and click the “Delete” button.

Awesome!
You've completed Lesson 85
START NEXT LESSON