Download presentation
Presentation is loading. Please wait.
1
Microsoft Excel 2003 Illustrated Complete
Automating Worksheet Tasks
2
Objectives Plan a macro Record a macro Run a macro Edit a macro
Use shortcut keys with macros Automating Worksheet Tasks
3
Objectives Use the Personal Macro Workbook Add a macro as a menu item
Create a toolbar for macros Automating Worksheet Tasks
4
Unit Introduction A macro is a set of instructions that performs tasks in the order you specify Create macros to automate frequently performed tasks that require a series of steps Automating Worksheet Tasks
5
Plan a Macro Create macros for tasks that you perform on a regular basis To create a macro, you record the series of actions in a special programming language The sequence of actions is important, so a macro needs to be carefully planned Automating Worksheet Tasks
6
Plan a Macro (cont.) Macro planning guidelines Assign the macro a name
Write out the steps the macro will perform Decide how you will perform the actions Practice the steps you want Excel to record and write them down Decide where to locate the description of the macro and the macro itself Automating Worksheet Tasks
7
Plan a Macro (cont.) Macro description Automating Worksheet Tasks
8
Plan a Macro (cont.) Macro and viruses
When you open an Excel workbook that has macros, a message appears asking if you want to enable or disable macros Macros can contain viruses which can damage your computer Always disable macros if you are not absolutely sure of the workbook’s source Automating Worksheet Tasks
9
Recording a Macro Use the Excel Macro Recorder to create a macro
Turn the Macro Recorder on Name the macro Enter the keystrokes and select the commands you want Stop the recorder Each action you record is translated into program code Automating Worksheet Tasks
10
Recording a Macro (cont.)
Enter macro name here Shows the computer user’s name and system date Automating Worksheet Tasks
11
Listed macros appear here
Running a Macro Once you record a macro, you should test it to make sure it runs properly Select the macro in the Macro dialog box, then click Run to test it Listed macros appear here Automating Worksheet Tasks
12
Editing a Macro The program instructions of a macro, called program code, are automatically recorded in the Visual Basic for Applications (VBA) programming language Each macro is stored as a module, or program code container attached to the workbook Edit a macro with the Visual Basic Editor Automating Worksheet Tasks
13
Project Explorer with open module
Editing a Macro (cont.) Macro program code Code window Comment Project Explorer with open module Properties window Automating Worksheet Tasks
14
Editing a Macro (cont.) Adding comments to Visual Basic code
You can explain macro code by adding comments Comments are explanatory text added to the lines of code A comment must be preceded by an apostrophe Automating Worksheet Tasks
15
Using Shortcut Keys with Macros
Assign a shortcut key combination to run a macro Reduces the number of steps it takes to run a macro Assign a shortcut key combination in the Record Macro dialog box Automating Worksheet Tasks
16
Using Shortcut Keys with Macros (cont.)
Shortcut to run macro Automating Worksheet Tasks
17
Using the Personal Macro Workbook
Store commonly used macros in a Personal Macro Workbook The Personal Macro Workbook is always available no matter which workbook is open Created the first time you store a macro Automating Worksheet Tasks
18
Using the Personal Macro Workbook (cont.)
Click to store in Personal Macro Workbook Click to store in new blank workbook Stores macro in active workbook Automating Worksheet Tasks
19
Using the Personal Macro Workbook (cont.)
Working with the Personal Macro Workbook By default the Personal Macro Workbook is hidden as a precautionary measure so you don’t accidentally delete anything from it Automating Worksheet Tasks
20
Adding a Macro as a Menu Item
Add macros to the Excel Worksheet menu bar The Worksheet menu bar is the toolbar at the top of the Excel screen Macros are always available on the Worksheet menu bar Automating Worksheet Tasks
21
Adding a Macro as a Menu Item (cont.)
Drag to menu location Automating Worksheet Tasks
22
Adding a Macro as a Menu Item (cont.)
Added menu item Automating Worksheet Tasks
23
Creating a Toolbar for Macros
Toolbars contain button that allow you to access commonly used commands Create your own custom toolbars in Excel Add button you want to any toolbar Automating Worksheet Tasks
24
Creating a Toolbar for Macros (cont.)
New Macros toolbar Automating Worksheet Tasks
25
Summary Use Excel Macro Recorder to create a macro
Run a macro to test it Use the Visual Basic Editor to edit a macro Use shortcut keys with macros Use the Personal Macro Workbook Automating Worksheet Tasks
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.