XL: Recording a Visual Basic Macro in an External Module

ID: Q108060


The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a


SUMMARY

In the versions of Microsoft Excel listed at the beginning of this article, you can record a macro and save it in a different workbook than the workbook you are performing the steps in. To do this, follow the steps below to set the macro recorder to record in the other workbook:

  1. Select the Visual Basic module in the workbook where the macro should begin recording.


  2. On the Tools menu, point to Record Macro, and click Mark Position for Recording.

    NOTE: At this point you can return to the workbook in which you plan to perform the steps. To begin recording, point to Record Macro on the Tools menu, and click Record at Mark.


NOTE: This method does not record the Sub() and End Sub statements necessary to create a separate Sub procedure. This is by design. To create a separate Sub procedure, add the Sub() and End Sub statements to the recorded code manually.

NOTE: This method is not available in Microsoft Excel 97 for Windows or Microsoft Excel 98 Macintosh Edition. For more information, please see the following article in the Microsoft Knowledge Base:
Q157958 XL97: No "Record at Mark" Feature in Microsoft Excel

Additional query words: 5.00a 5.00c 7.00a XL5 XL7

Keywords : kbprg PgmHowto
Version : MACINTOSH:5.0,5.0a; WINDOWS:5.0,5.0c,7.0,7.0a
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


Last Reviewed: October 18, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.