These pages are no longer updated and are only available for archive purposes.
Click here to visit the pages with updated information.
How to use the macro examples
You will have to set the macro security to Medium or Low (not
recommended) to enable the application to run macros.
The macro security can be set from this menu: Tools, Macro, Security.
Select and copy the code you are interested in from the web page
(click and drag to select, press Ctrl+C to copy).
Open a new workbook, or the workbook you want to use the code in.
- Press Alt+F11 to open the Visual Basic Editor (VBE).
- Select Insert, Module to insert a new code module into your
Some code examples are supposed to be pasted into special code modules (e.g. ThisWorkbook),
this will be specified on the web page with the example.
- Press Ctrl+V to paste the copied example code into the code module.
- Press Alt+F11 to go back to Excel.
- Press Alt+F8 to open the Macro dialog box.
- Double-click on the name of the macro you want to run.
If the name of the macro you want to run is not visible in the Macro
dialog box, this can be caused by the fact that the macro need input to start,
Sub ExampleMacro(strName As String)
MsgBox "Hello " & strName
The macro above can be started from another macro like this:
ExampleMacro "John Doe"