Example

In this example we are going to create a simple macro that we can run from any workbook.
This macro will select cells "A1:B10" on the active worksheet and shade the cells Blue.
There is a button on the status bar that you can use to quickly record a macro.

microsoft excel docs

Before we actually start recording the macro it is definitely worth displaying the Developer Tab.
The button on the status bar is just a shortcut to the "Record Macro" button on the Developer tab.


Record the Macro

Close and ReOpen Excel and create a new blank workbook.
Display the "Record Macro" dialog box.
Select the "Personal Macro Workbook" from the store macro in drop-down box.

microsoft excel docs

Press OK to start recording.
Select the cell range "A1:B10".
Right mouse click and choose Format Cells from the shortcut menu.
Select the Fill tab. Choose a Blue colour and press OK.


Stop Recording

When you have finished recording your actions press the "Stop Recording" button the Developer tab.
Alternatively you can press the button on the status bar.

microsoft excel docs

Close Excel and Save The Changes

Once you have finished recording your macro, close Excel.
Before Excel closes you will see the following popup message.
Every time changes are made to your Personal Macro Workbook you will prompted to save the changes before Excel closes.

microsoft excel docs

Press Save. Once Excel has closed the file will appear in your XLStart folder.


Using the Macro

ReOpen Excel and create a new blank workbook.
Display the Developer Tab and press the Macros button.

microsoft excel docs

This displays the "Macro" dialog box that displays all the macros that are currently available.
The macros in drop-down box at the bottom will default to "All Open Workbooks".
All open workbooks will include your Personal Macro Workbook.

microsoft excel docs

This new macro can be used on any active workbook.
To run the macro press the "Run" button at the top.


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext