Copy a macro module to another workbook

If a workbook contains a Visual Basic for Applications (VBA) macro that you would like to use elsewhere, you can copy the module that contains that macro to another open workbook by using the Visual Basic Editor (VBE).

Macros and VBA tools can be found on the Developer tab, which is hidden by default, so the first step is to enable it.

For Windows, go to File > Options > Customize Ribbon.

For Mac, go to Excel > Preferences... > Ribbon & Toolbar.

Next, in the Customize the Ribbon section, under Main Tabs, check the Developer check box.

Copying a module from one workbook to another

Open both the workbook that contains the macro you want to copy, and the workbook where you want to copy it.

On the Developer tab, in the Code group, click Visual Basic to open the Visual Basic Editor.