Microsoft Office Tutorials and References
In Depth Information
Altogether, the various tracing modes and watch types provide a very powerful set of tools for
debugging code. I use them often!
In earlier days, a macro consisted of a series of keystrokes that was recorded and assigned to a hot
key. When a user invoked the hot key, the recording would play and the recorded keystrokes
would be executed.
These days, macros (at least for Microsoft Office) are much more sophisticated. In fact, an Excel
macro is just a special type of subroutine—one that does not have any parameters. (We will
4.7.1 Recording Macros
Excel has the capability of recording very simple macros. When we ask Excel to record a macro
by selecting Macro Record New Macro from Excel's (not Excel VBA's) Tools menu, it takes
note of our keystrokes and converts them into a VBA subroutine (with no parameters).
For example, suppose we record a macro that does a find and replace, replacing the word "macro"
by the word "subroutine." When we look in the Projects window under the project in which the
macro was recorded, we will find a new subroutine in a standard code module:
' Macro1 Macro
' Macro recorded 9/13/98 by sr
Cells.Replace What:="macro", Replacement:="subroutine", _