Professional Documents
Culture Documents
5 Essential Tips For Creating Excel Macros
5 Essential Tips For Creating Excel Macros
Excel macros save you time and headaches by automating common, repetitive tasks. And
you don’t have to be a programmer or know Visual Basic Applications (VBA) to write one. With
Excel 2013, it’s as simple as recording your keystrokes. Use these tips to make macro
recording a cinch.
1. Macro names
Keep macro names short (but descriptive), especially if you record a lot of macros, so
you can easily identify them in the Macro Dialog Box. The system also provides a field for
Description, though not everyone uses it.
Macro names must begin with a letter and cannot contain spaces, symbols, or
punctuation marks. After the first letter, you can use more letters, numbers, or the underscore
character, but the maximum length is 80 characters.
In the April Report example, you wouldn't combine the calculation macro with the format
macro. You'd use one macro to combine all the branch workbooks into one final spreadsheet, a
second macro to calculate the data, a third macro to format the spreadsheet, a fourth macro
to create charts, and perhaps a fifth macro to print.
If a macro fails, you can troubleshoot it by stepping through it one line at a time. It’s like
slow motion, only you control each time the next event occurs using the F8 key.
ClickDeveloper>Macro, select your macro from the list, then click the Step Into button. Shrink
the Code window down and place it on the bottom right side of the screen so you can see your
spreadsheet behind it. Press F8 each time you want the macro to proceed to the next step. The
macro stops when it reaches the error. You can then repair the error or record a new macro.