Excel Macros
Additional Resources
Excel Macros
Excel Macros
|
Excel Macros | Microsoft Excel XP
|
|
Learn step-by-step how to record, run, stop and delete Excel macros. Also
learn how to assign an Excel macro to a button, menu or a shortcut key command.
If you perform a task repeatedly in Microsoft Excel, you can automate the task
with a macro. A macro is a series of commands and
functions that are stored in a Microsoft Visual Basic
module
and can be run whenever you need to perform the task.
For example, if you often enter long text strings in cells, you can create a
macro to format those cells so that the text wraps.
No matter what you choose to do,
Excel macros can make your daily
tasks much easier!
Create Excel Macros
When you record a macro, Excel stores information about each step you take
as you perform a series of commands. You then run the macro to repeat, or
"play back", the commands. If you make a mistake when you record the
macro, corrections you make are also recorded. Visual Basic stores each
macro in a new module attached to a workbook.
|
Change the
Security Level!
Before recording a macro, you need
to change the Security Level of the workbook.
1. Choose
Tools ►
Options from the menu bar.
2. Click the Security tab.
3. From the Macro Security option, click the
Macro Security button.
4.
Click the Security Level tab, and
then select the security level you want to use.
5. Click OK
and then click OK again. |
To start recording Excel macros, follow these steps:
1. |
Choose "Tools" ► "Macro" ► "Record
New Macro" from the menu bar.
The Record
Macro dialog box opens. |
|
|
|
|
|
|
2. |
In the "Macro Name" text box, type a name for
the macro which you are about to start recording. |
|
|
|
CAUTION:
The first character of the macro name must be a letter.
Other characters can be
letters, numbers, or underscore characters.
Spaces are not allowed in a macro
name.
Do not use a macro name that is also a cell reference or you can
get an error message that the macro name is not valid.
|
|
|
|
3. |
If you want to run the macro by pressing a keyboard shortcut
key, enter a letter in the
Shortcut key box.
You can use CTRL+
letter (for
lowercase letters) or CTRL+SHIFT+
letter (for uppercase letters), where
letter is any
letter key on the keyboard.
The shortcut key letter you use
cannot be a number or special character such as @ or #. |
|
|
|
CAUTION!
The shortcut key will override any
equivalent default Microsoft Excel shortcut keys while the
workbook that contains the macro is open.
|
|
|
|
4. |
From the Store macro in
box, select the location where you want to store the macro.
If you want a macro to be available whenever you use Excel, select
Personal Macro Workbook. |
|
|
5. |
From the Description box,
type in a description of the macro if you want to include it. |
|
|
6. |
Click OK. |
|
|
|
The Stop Recording toolbar appears, and in the Status bar at
the bottom-right the words "Ready Recording" are displayed.
Stop Recording toolbar
If you want the macro to run
relative to the position of the active cell, record
it using relative cell references.
On the
Stop Recording
toolbar, click the
Relative Reference
button so that it is selected. Excel
will continue to record macros with relative references
until you quit Excel or until you click the Relative Reference
button again, so that it is not
selected.
Relative Reference button
|
|
|
|
7. |
Start performing the actions you want to include in your
macro. |
|
|
8. |
To stop recording your macro, click the "Stop Recording"
button to stop the macro. |
|
Stop Recording button |
|
Excel XP Topics
- Tips
- Excel Screen Layout
- Navigational Techniques
- Working with Workbooks
- Templates
- Working with Worksheets
- Moving Around
- Move Worksheets
- Copy Worksheets
- Insert & Delete Cells
- Insert & Delete Rows
- Insert & Delete Columns
- Resize Row
- Resize Column
- Editing Data
- Content Color
- Cell Color
- Number Formats
- Fonts
- Alignment
- Text Direction
- Indent Contents
- Merge Cells
- Copy
- Move
- Undo & Redo
- Using Zoom
- Freeze & Unfreeze Titles
- Split Worksheet
- Spreadsheet Data
- AutoFill
- AutoComplete
- Comment
- Find
- Replace
- Spellcheck
- Formulas
- Functions
- Print
- Password
- Sorting
- AutoFilter
- Advanced Filter
- Macros
- Charts
- Charting
- Charting Elements
- Gantt Chart
- PivotTable
- PivotTable Calculations
- PivotTable Layout
- PivotTable Format
- PDF to Excel
- PDF-to-Excel Converter
- Excel to PDF Converter
|