|
5.14
Creating
And
Using
Macros
5.14.7
Running
macros
with
a
macro
button
You
can
assign
a
macro
to
a
button,
drawing
object,
or
a
graphic
control
on
your
worksheet.
When
you
click
the
button
or
drawing
object,
or
change
the
control —
for
example,
by
clicking
a
check
box
or
an
item
in
a
list —
your
macro
will
run
automatically.
You
can
also
run
a
macro
from
an
ActiveX
control.
More
information
about
creating
an
ActiveX
control.
1.
Click
the
button
or
graphic
control
so
that
selection
handles
appear.
2.
Right-click
a
selection
handle
for
the
button
or
graphic
control,
and
then
click
Assign
Macro
on
the
shortcut
menu.
3.
To
assign
an
existing
macro
to
the
button
or
graphic
control,
enter
the
name
of
the
macro
in
the
Macro
name
box,
and
then
click
OK.
To
record
a
new
macro
to
assign
to
the
button
or
graphic
object,
click
Record.
To
write
a
new
macro
in
the
Visual
Basic
Editor,
click
New.
To
edit
an
existing
macro,
click
the
name
of
the
macro
in
the
Macro
Name
box,
and
then
click
Edit.
Note
If
you
assign
a
macro
to
a
button
or
other
object
that
is
already
in
use
as
a
hyperlink,
the
hyperlink
information
is
deleted.
From
then
on,
clicking
the
button
or
object
runs
the
macro
instead.
5.14.8
Using
a
keyboard
shortcut
to
run
a
macro
1.
On
the
Tools
menu,
point
to
Macro,
and
then
click
Macros.
2.
In
the
Macro
name
box,
enter
the
name
of
the
macro
you
want
to
assign
to
a
keyboard
shortcut.
3.
Click
Options.
4.
To
run
the
macro
by
pressing
a
keyboard
shortcut
key,
enter
a
letter
in
the
Shortcut
key
box.
You
can
use
CTRL+
letter
or
CTRL+SHIFT+
letter,
where
letter
is
any
letter
key
on
the
keyboard.
The
shortcut
key
will
override
any
default
Microsoft
Excel
shortcut
keys
while
the
workbook
that
contains
the
macro
is
open.
5.
To
include
a
description
of
the
macro,
type
the
description
in
the
Description
box.
6.
Click
OK.
7.
Click
Cancel.
  
|