Microsoft Office Tutorials and References
In Depth Information
Testing the macro
Figure 204-1: The MyName macro was generated by Excel’s macro recorder.
Notice that Excel inserted some comments at the top of the procedure. This is some of the
information that appeared in the Record Macro dialog box. These comment lines (which begin with an
apostrophe) aren’t necessary, and deleting them has no effect on how the macro runs.
Testing the macro
Before you recorded this macro, you set an option that assigned the macro to the Ctrl+Shift+N
shortcut key combination. To test the macro, return to Excel by pressing Alt+F11.
When Excel is active, activate a worksheet. (It can be in the workbook that contains the VBA
module or in any other workbook.) Select a cell or range and press Ctrl+Shift+N. The macro
immediately enters your name into the cell.
In this example, notice that you selected the cell before you started recording your
macro. This is important. If you select a cell while the macro recorder is turned on, the
actual cell that you selected is recorded into the macro. In such a case, the macro
always enters your name into that cell, so the macro isn’t a “general-purpose” macro.
 
Search JabSto ::




Custom Search