Attach a macro command to a button It's sometimes very interesting to be able to execute macro commands by just pressing a button; ev en more if yo leave your file to another person. They probably don't know all the macro commands that you created to work fa The next exercise consists in attaching a macro command to a button. IMPORTANT: You must already have created a macro that you will need before attaching it to a button. From the Edit menu, select the Toolbar option. From the list of the available toolbars, select the Forms toolbar. This toolbar offers you several objects, or controls, that you can place on forms. For the moment, you only have worry about the button to attach a macro command. Press the button. Press the left mouse button and determine the place and size of the button. When satisfied with the size, release the left mouse button. Excel will automatically ask you for the n ame of the macro that you want to attach to the newl y created button. Move the toolbar if it's necessary. Place the cursor on the titles bar of the toolbar (the blue bar on top). Press the left mouse button and move the toolbar towards the place of your choice. Once the toolbar is at its new location, release the left mouse button. This toolbar is used for creating forms in Excel files. It facilitates the use of the model for the users.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
It's sometimes very interesting to be able to execute macro commands by just pressing a button; even moleave your file to another person. They probably don't know all the macro commands that you created to
The next exercise consists in attaching a macro command to a button.
IMPORTANT: You must already have created a macro that you will need before attaching it to a button
From the Edit menu, select the Toolbar option.From the list of the available toolbars, select the Forms toolbar.
This toolbar offers you several objects, or controls, that you can place on forms. For the moment, you on
worry about the button to attach a macro command.
Press the button.Press the left mouse button and determine the place and size of the button.
When satisfied with the size, release the left mouse button.
Excel will automatically ask you for the name of the macro that you want to attach to the newly created b
Move the toolbar if it's necessary.
Place the cursor on the titles bar of the toolbar (the blue bar on top).Press the left mouse button and move the toolbar towards the place of your choice.
Once the toolbar is at its new location, release the left mouse button.
This toolbar is used for creating forms in Excel files. It facilitates the use of the model for the
Like for the protection for cells, it's also possible to protect buttons under the Protection tab. By default, buttons are protected when the protection is activated. You should leave it protected unless you want the
able change the button properties for some reason.
The Properties tab allows you to decide if the button should change size and placement when you changchange you size and placement of the cells of the worksheet below it. You can also decide to move or no
if you insert or delete rows and columns. By default, the button will not be printed unless you activate th
The Margins tab allows you to control the margin, or the space between the text on the button and its bocan use the predetermined margins or change them to your choice.
You can always save this worksheet as a Web page. So Excel offers you some Web properties under the For buttons, it only allows you to put some alternate
Assign a macro to a drawingIt's interesting, even practical, to place a macro on a command button. It's easier for the users to use the o
you prepared them for them. But these buttons lack originality. They're grey! That's why Excel also offer
possibility of placing a macro on a drawing. With a bit of work, these drawings can have very interestingare some examples.
Before being able to attach a macro to a drawing, you need two things: a drawing and a macro. Let's pres
you already have both. The next part consists only in attaching a macro to a drawing.
From the context menu, select the Assign macro option.
From the list of macro commands that you have already prepared, select the one of your choice.
Press the OK button.
If you can't select the Assign macro option, click on the border of the drawing instead of the text inside i
should then be able to assign the macro of your choice. You can repeat this operation on as many drawinwant. It certainly puts a little fun in your file!
Assign a macro to a toolbar
Assigning a button to a toolbar can be done in two
Create a new toolbar
From the View menu, select the options Toolbar and Customize.
You can now make macros, apply them where you want them and even create toolbars! But it's not over.
button picture was placed on the toolbar when you added a macro command to it. Excel offers you a list you can use to better represent what your macro command will do.
You must place the cursor in that cell before you can begin your "macro". You'll see why later on.
From the Tools menu, select the Macro option.Select the Record New macro option.
A new window will open asking you for some information about the new macro. The first box asks you f
that you give to this macro. You can also put a letter or a number in the shortcut box. You'll be able to exmacro by pressing the Ctrl and a keys. You can place in any letter or number that you want. The shortcu
compulsory.
The window asks you if you want to store the macro in this file or in another worksheet file. It's possible
the macro commands in a personal macro file. The same macro can then be used for several files. But thi
those that are really serious about using macros.
For the exercise:
Give a name to your macro. It should represent the actions that will be done such as " Printing_the_budgname of the macro cannot have any spaces. An underline can be used to link words. It's also possible to h
shortcut key to activate a macro command. This avoids you having to go into the Tools menu, followed b
Macro, Macro commands, select the macro of your choice and pressing on the Execute button.
All the actions that you go to make will be added to the macro command until you stop the recording.
As soon as you press the OK button, the window disappears and a small toolbar appears in its place. Thitoolbar has only two buttons. The first one is to stop the macro from recording. The second is to activate
deactivate the relative reference option. This can be important according to the type of macro that you w
out. You do not activate this option if you want the macro to do whatever you want it to do at always the
location. You activate this option if you want the macro to start where the active cursor is located. There details of this option a little later on this page.
Press the second button to be sure that the relative option is activated. (It's very important for this demo
Make a block out of the A1 to C1 cells.
Press the Fill button to change the cell's background color to the color of your choice.
Press the first button of the macro toolbar to stop the macro from recording.
OR
From the Tools menu, select the Macro and Stop recording options.
The new macro command is now complete. It could have had a lot more instructions than this example. B
only to demonstrate what a macro can do. It's time to see if you may repeat it.
Place the cursor in the A3 cell.Press the Ctrl and A keys to activate the shortcut to the macro.
Here is the result of the macro. The cells of the third row have now the same background color as the on
for the cells of the first row.
There is an explanation if it didn't work. You forgot to activate the relative position option when asked. E
repeat the macro at the same location instead of beginning it where the cursor is located. It's as for that re
was asked to you to move the cursor in the A3 cell and to activate the relative button.
Because the relative reference option was activated, you may execute the macro to another place rather th
was created. You just need to put the cursor where you need to activate the macro. If the relative option i
activated, the macro will always repeat itself at the same location.
It can be practical for your needs. It depends on the box. You decide when you should activate the relativoption or not. It's practical when you know that you'll want to apply the macro to another place in your fi
last exercise, it was necessary to be able to apply it to the A3 to C3 cells.
A 1004 error message can also appear. Generally, it's because you forgot to stop the macro command fro
The macro is then caught in an endless loop. The macro is recalled before it's even finished! It will be ne
change the macro.
Change a macro command
From the Tools menu, select the Macro option
Select the macro of your choice and press the Edit button.
Press the button.Press the left mouse button and determine the place and size of the button.When satisfied with the size, release the left mouse button.
Excel will automatically ask you for the name of the macro that you want to attach to the newly created b
Select the macro of your choice.
Press the OK button.
While the button is still selected, you can change the text on the button to whatever you need it to be.
Once finished, click outside of the button.
To execute the macro that's now connected to the button.
Place the cursor in the A5 cell.
Place the cursor over the button.
Press the left mouse button.
The button now executes the macro. You can apply any macro that you make to a button. It's that easy!
Like for the protection for cells, it's also possible to protect buttons under the Protection tab. By default, buttons are protected when the protection is activated. You should leave it protected unless you want the
able change the button properties for some reason.
The Properties tab allows you to decide if the button should change size and placement when you changchange you size and placement of the cells of the worksheet below it. You can also decide to move or no
if you insert or delete rows and columns. By default, the button will not be printed unless you activate th
The Margins tab allows you to control the margin, or the space between the text on the button and its bocan use the predetermined margins or change them to your choice.
You can always save this worksheet as a Web page. So Excel offers you some Web properties under the For buttons, it only allows you to put some alternate
Assign a macro to a drawingIt's interesting, even practical, to place a macro on a command button. It's easier for the users to use the o
you prepared them for them. But these buttons lack originality. They're grey! That's why Excel also offer
possibility of placing a macro on a drawing. With a bit of work, these drawings can have very interestingare some examples.
Before being able to attach a macro to a drawing, you need two things: a drawing and a macro. Let's pres
you already have both. The next part consists only in attaching a macro to a drawing.
From the context menu, select the Assign macro option.
From the list of macro commands that you have already prepared, select the one of your choice.
Press the OK button.
If you can't select the Assign macro option, click on the border of the drawing instead of the text inside i
should then be able to assign the macro of your choice. You can repeat this operation on as many drawinwant. It certainly puts a little fun in your file!
Assign a macro to a toolbar
Assigning a button to a toolbar can be done in two
Create a new toolbar
From the View menu, select the options Toolbar and Customize.
You can now make macros, apply them where you want them and even create toolbars! But it's not over.
button picture was placed on the toolbar when you added a macro command to it. Excel offers you a list you can use to better represent what your macro command will do.
The size of the picture and the number of colors is limited but not your imagination. You can try any formshade on it, anything you can think!
Once you created the picture you wish, press the OK button.
You can now create you own macros and toolbars. This will help you personalize Excel to better answer
make you more efficient. That's what this site is all about!
Webanalytics provided by
This site is hosted by 1&1.com
Change button picture
You can now make macros, apply them where you want them and even create toolbars! But it's not over. button picture was placed on the toolbar when you added a macro command to it. Excel offers you a list
you can use to better represent what your macro command will do.
The size of the picture and the number of colors is limited but not your imagination. You can try any formshade on it, anything you can think!
Once you created the picture you wish, press the OK button.
You can now create you own macros and toolbars. This will help you personalize Excel to better answer
make you more efficient. That's what this site is all about!
Webanalytics provided by
This site is hosted by 1&1.com
Introduction
A macro command is a series of instructions that are always executed one after the other in the same ordvery practical to automate repetitive tasks. The exercise that follows will demonstrate how to create a macommand. The next macro basically changes the background color of the selected cells. It contains only
command. But after you've finished, you will be able create your own "macros" and insert as many instru
Give a name to your macro. It should represent the actions that will be done such as " Printing_the_budg
name of the macro cannot have any spaces. An underline can be used to link words. It's also possible to h
shortcut key to activate a macro command. This avoids you having to go into the Tools menu, followed b
Macro, Macro commands, select the macro of your choice and pressing on the Execute button.
Enter the data as shown in the picture above.Press the OK button.
All the actions that you go to make will be added to the macro command until you stop the recording.
As soon as you press the OK button, the window disappears and a small toolbar appears in its place. Thi
toolbar has only two buttons. The first one is to stop the macro from recording. The second is to activate
deactivate the relative reference option. This can be important according to the type of macro that you wout. You do not activate this option if you want the macro to do whatever you want it to do at always the
location. You activate this option if you want the macro to start where the active cursor is located. There
details of this option a little later on this page.
Press the second button to be sure that the relative option is activated. (It's very important for this demo
Make a block out of the A1 to C1 cells.
Press the Fill button to change the cell's background color to the color of your choice.
Press the first button of the macro toolbar to stop the macro from recording.
OR From the Tools menu, select the Macro and Stop recording options.
The new macro command is now complete. It could have had a lot more instructions than this example. B
only to demonstrate what a macro can do. It's time to see if you may repeat it.
Place the cursor in the A3 cell.
Press the Ctrl and A keys to activate the shortcut to the macro.
Here is the result of the macro. The cells of the third row have now the same background color as the onfor the cells of the first row.
There is an explanation if it didn't work. You forgot to activate the relative position option when asked. Erepeat the macro at the same location instead of beginning it where the cursor is located. It's as for that re
was asked to you to move the cursor in the A3 cell and to activate the relative button.
Because the relative reference option was activated, you may execute the macro to another place rather th
was created. You just need to put the cursor where you need to activate the macro. If the relative option i
activated, the macro will always repeat itself at the same location.
It can be practical for your needs. It depends on the box. You decide when you should activate the relativ
option or not. It's practical when you know that you'll want to apply the macro to another place in your filast exercise, it was necessary to be able to apply it to the A3 to C3 cells.
A 1004 error message can also appear. Generally, it's because you forgot to stop the macro command froThe macro is then caught in an endless loop. The macro is recalled before it's even finished! It will be ne
change the macro.
Change a macro command
From the Tools menu, select the Macro optionSelect the macro of your choice and press the Edit button.
From the File menu, select the Close and return to Microsoft Excel option.
Attach a macro command to a button
It's sometimes very interesting to be able to execute macro commands by just pressing a button; even mo
leave your file to another person. They probably don't know all the macro commands that you created to
The next exercise consists in attaching a macro command to a button.
IMPORTANT: You must already have created a macro that you will need before attaching it to a button
From the Edit menu, select the Toolbar option.
From the list of the available toolbars, select the Forms toolbar.
This toolbar offers you several objects, or controls, that you can place on forms. For the moment, you onworry about the button to attach a macro command.
Press the button.
Move the toolbar if it's necessary.
Place the cursor on the titles bar of the toolbar (the blue bar on top).
Press the left mouse button and move the toolbar towards the place of your choice.
Once the toolbar is at its new location, release the left mouse button.
This toolbar is used for creating forms in Excel files. It facilitates the use of the model for the
Like for the protection for cells, it's also possible to protect buttons under the Protection tab. By default, buttons are protected when the protection is activated. You should leave it protected unless you want the
able change the button properties for some reason.
The Properties tab allows you to decide if the button should change size and placement when you changchange you size and placement of the cells of the worksheet below it. You can also decide to move or no
if you insert or delete rows and columns. By default, the button will not be printed unless you activate th
The Margins tab allows you to control the margin, or the space between the text on the button and its bocan use the predetermined margins or change them to your choice.
You can always save this worksheet as a Web page. So Excel offers you some Web properties under the For buttons, it only allows you to put some alternate
Assign a macro to a drawingIt's interesting, even practical, to place a macro on a command button. It's easier for the users to use the o
you prepared them for them. But these buttons lack originality. They're grey! That's why Excel also offer
possibility of placing a macro on a drawing. With a bit of work, these drawings can have very interestingare some examples.
Before being able to attach a macro to a drawing, you need two things: a drawing and a macro. Let's pres
you already have both. The next part consists only in attaching a macro to a drawing.
From the context menu, select the Assign macro option.
From the list of macro commands that you have already prepared, select the one of your choice.
Press the OK button.
If you can't select the Assign macro option, click on the border of the drawing instead of the text inside it
should then be able to assign the macro of your choice. You can repeat this operation on as many drawinwant. It certainly puts a little fun in your file!
Assign a macro to a toolbar
Assigning a button to a toolbar can be done in two
Create a new toolbar
From the View menu, select the options Toolbar and Customize.
You can now make macros, apply them where you want them and even create toolbars! But it's not over.
button picture was placed on the toolbar when you added a macro command to it. Excel offers you a list you can use to better represent what your macro command will do.
The size of the picture and the number of colors is limited but not your imagination. You can try any formshade on it, anything you can think!
Once you created the picture you wish, press the OK button.
You can now create you own macros and toolbars. This will help you personalize Excel to better answer
make you more efficient. That's what this site is all about!
Webanalytics provided by
This site is hosted by 1&1.com
Introduction
A macro command is a series of instructions that are always executed one after the other in the same ordvery practical to automate repetitive tasks. The exercise that follows will demonstrate how to create a macommand. The next macro basically changes the background color of the selected cells. It contains only
command. But after you've finished, you will be able create your own "macros" and insert as many instru
Give a name to your macro. It should represent the actions that will be done such as " Printing_the_budg
name of the macro cannot have any spaces. An underline can be used to link words. It's also possible to h
shortcut key to activate a macro command. This avoids you having to go into the Tools menu, followed b
Macro, Macro commands, select the macro of your choice and pressing on the Execute button.
Enter the data as shown in the picture above.Press the OK button.
All the actions that you go to make will be added to the macro command until you stop the recording.
As soon as you press the OK button, the window disappears and a small toolbar appears in its place. Thi
toolbar has only two buttons. The first one is to stop the macro from recording. The second is to activate
deactivate the relative reference option. This can be important according to the type of macro that you wout. You do not activate this option if you want the macro to do whatever you want it to do at always the
location. You activate this option if you want the macro to start where the active cursor is located. There
details of this option a little later on this page.
Press the second button to be sure that the relative option is activated. (It's very important for this demo
Make a block out of the A1 to C1 cells.
Press the Fill button to change the cell's background color to the color of your choice.
Press the first button of the macro toolbar to stop the macro from recording.
OR From the Tools menu, select the Macro and Stop recording options.
The new macro command is now complete. It could have had a lot more instructions than this example. B
only to demonstrate what a macro can do. It's time to see if you may repeat it.
Place the cursor in the A3 cell.
Press the Ctrl and A keys to activate the shortcut to the macro.
Here is the result of the macro. The cells of the third row have now the same background color as the onefor the cells of the first row.
There is an explanation if it didn't work. You forgot to activate the relative position option when asked. Erepeat the macro at the same location instead of beginning it where the cursor is located. It's as for that re
was asked to you to move the cursor in the A3 cell and to activate the relative button.
Because the relative reference option was activated, you may execute the macro to another place rather th
was created. You just need to put the cursor where you need to activate the macro. If the relative option i
activated, the macro will always repeat itself at the same location.
It can be practical for your needs. It depends on the box. You decide when you should activate the relativ
option or not. It's practical when you know that you'll want to apply the macro to another place in your filast exercise, it was necessary to be able to apply it to the A3 to C3 cells.
A 1004 error message can also appear. Generally, it's because you forgot to stop the macro command froThe macro is then caught in an endless loop. The macro is recalled before it's even finished! It will be ne
change the macro.
Change a macro command
From the Tools menu, select the Macro optionSelect the macro of your choice and press the Edit button.
From the File menu, select the Close and return to Microsoft Excel option.
Attach a macro command to a button
It's sometimes very interesting to be able to execute macro commands by just pressing a button; even mo
leave your file to another person. They probably don't know all the macro commands that you created to
The next exercise consists in attaching a macro command to a button.
IMPORTANT: You must already have created a macro that you will need before attaching it to a button
From the Edit menu, select the Toolbar option.
From the list of the available toolbars, select the Forms toolbar.
This toolbar offers you several objects, or controls, that you can place on forms. For the moment, you onworry about the button to attach a macro command.
Press the button.
Move the toolbar if it's necessary.
Place the cursor on the titles bar of the toolbar (the blue bar on top).
Press the left mouse button and move the toolbar towards the place of your choice.
Once the toolbar is at its new location, release the left mouse button.
This toolbar is used for creating forms in Excel files. It facilitates the use of the model for the
Like for the protection for cells, it's also possible to protect buttons under the Protection tab. By default, buttons are protected when the protection is activated. You should leave it protected unless you want the
able change the button properties for some reason.
The Properties tab allows you to decide if the button should change size and placement when you changchange you size and placement of the cells of the worksheet below it. You can also decide to move or no
if you insert or delete rows and columns. By default, the button will not be printed unless you activate th
The Margins tab allows you to control the margin, or the space between the text on the button and its bocan use the predetermined margins or change them to your choice.
You can always save this worksheet as a Web page. So Excel offers you some Web properties under the For buttons, it only allows you to put some alternate
Assign a macro to a drawingIt's interesting, even practical, to place a macro on a command button. It's easier for the users to use the o
you prepared them for them. But these buttons lack originality. They're grey! That's why Excel also offer
possibility of placing a macro on a drawing. With a bit of work, these drawings can have very interestingare some examples.
Before being able to attach a macro to a drawing, you need two things: a drawing and a macro. Let's pres
you already have both. The next part consists only in attaching a macro to a drawing.
From the context menu, select the Assign macro option.
From the list of macro commands that you have already prepared, select the one of your choice.
Press the OK button.
If you can't select the Assign macro option, click on the border of the drawing instead of the text inside i
should then be able to assign the macro of your choice. You can repeat this operation on as many drawinwant. It certainly puts a little fun in your file!
Assign a macro to a toolbar
Assigning a button to a toolbar can be done in two
Create a new toolbar
From the View menu, select the options Toolbar and Customize.
You can now make macros, apply them where you want them and even create toolbars! But it's not over.
button picture was placed on the toolbar when you added a macro command to it. Excel offers you a list you can use to better represent what your macro command will do.