Office 2007 - Excel

Lesson 81 : “Macros”

81/83 Lessons 

What are Macros?

Macros are small programs that are used to do repetitive tasks automatically.
A Macro stores all the keyboard actions as a Visual Basic program.
When we want to run a macro later, we only have to press one button to do the whole series of actions, which we previously performed.
Suppose, we have a company name, address and phone in the left corner on every sheet of our workbook.
When we include all these actions in a macro, we need to run the macro to do this automatically.

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.
If you do this, make sure that 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 will be available only in the workbook where you currently are working.
If you choose “Personal Macro Workbook”, the macro available to all files that we create in Excel.

In the last box we can enter the description which is optional.
Click the OK button.
From now on, every action you perform in the worksheet will be included in the macro.

When you’re done, click the Stop Recording button, at the bottom of the status bar

Or click the “Macro” button in the “View” tab and select “Stop Recording” from the drop-down menu.

Macro

To run a recorded macro,click the “Macros” 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.

Editing Macro

To modify a macro, click the “Macros” 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 on top of the macro code.
You can make changes in the code itself if you know Visual Basic.
If you do not know, close the window.

Delete A Macro

To delete a macro, click the “Macros” 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 81
START NEXT LESSON