Recording a Visual Basic Macro in an External Module (108060)



The information in this article applies to:

  • Microsoft Excel for Windows 95 7.0a
  • Microsoft Excel for Windows 95
  • Microsoft Excel for Windows 5.0c
  • Microsoft Excel for Windows 5.0
  • Microsoft Excel for the Macintosh 5.0a
  • Microsoft Excel for the Macintosh 5.0

This article was previously published under Q108060

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:

157958 XL97: No "Record at Mark" Feature in Microsoft Excel


Modification Type:MinorLast Reviewed:10/10/2006
Keywords:kbhowto kbProgramming KB108060