Copying a Macro module present in a workbook to another workbook in Excel 2010


The following tutorial will guide you on how to copy a Macro module present in a workbook to another workbook in Microsoft Excel 2010 application.


If your workbook has a Visual Basic for applications Macro module and you intend to use that Macro module in some other open workbook, you can copy that Macro module to that open workbook by using the Visual Basic for Applications editor.

If you are unfamiliar with the VBA editor and Macros refer the article Create and run a Macro in Microsoft Excel 2010 application.


NOTE: - A macro is a set of actions or an action that automate repetitive tasks. Macros are recorded using the VBA editor. You can inspect and edit Macros in the VBA editor, a window opened by the Excel application.. refer the figure below for details.


Figure 1



Here we are copying the Macro named itechtalk1 contained in Module1 of the itechtalkasd workbook to another workbook itechtalkqwe.


Now, let us look into the steps to be followed to copy a Macro module from one workbook to another workbook.

1) Firstly, you should add the Developer tab to the ribbon.

2) Next, enable all Macros in the application.

3) Open the workbook ‘itechtalkasd’ that contains the Macro Module1 that you wish to copy into another workbook ‘itechtalkqwe’.


4) Click on the “Visual Basic” icon present on the Developer tab under the Code group.


Figure 2



5) Now, in the Visual Basic editor, click “project Explorer’ present inside the View Menu.


Figure 3



6) Drag the Module ‘itechtalk1’ that you wish to copy to the destination workbook present in the Project explorer box (typically named as VBAproject(<Workbookname>). For example, if you copy the Module ‘itechtalk1’ from VBAproject(itechtalkasd) to VBAproject(itechtalkqwe), the module will be copied as itechtalk1 in the Module nodes under the VBAproject(itechtalkqwe). Refer the figure below for details.


Figure 4



So, this is how you can use the VBA editor to copy a Macro Module from one workbook to another workbook in Microsoft Excel 2010 application.


Read Other Applications