Inside The Web
    Facebook Twitter Instagram
    Inside The Web
    • Office
      • Excel
      • Ms Word
      • OneDrive
      • Google Docs
      • Google Sheets
      • Google Drive
    • Email
      • Gmail
      • Outlook
      • Emal Etiquette
    • Office Etiquette
    • Productivity
    Inside The Web
    Home»Office»Excel»How to Copy Macros in Excel

    How to Copy Macros in Excel

    Nisha GurungBy Nisha GurungJuly 2, 2023 Excel 4 Mins Read

    Macros are one of the game changing features for Excel users who need to perform repetitive tasks on a daily basis. What I personally like most about Macros is that once you record a Macro, it allows you to run it in any workbook and at any time you want. So, why not copy the captured Macros and use them in all other workbooks? Check out these four effective ways to share your macro in Excel.

    Warning: The Macros you copy from the Workbook will run in the exact cell ranges as specified in the VBA code.

    Method 1: Drag Macro Module

    Firstly, the easiest way to copy Macros from one workbook to another is by dragging the Macro Module. This is my go-to method as it reduces the possible errors when copying the code.

    Before you begin, open two Excel Workbooks. One with the Macro and the other workbook to copy. Then, make sure you have added the Developer tab and follow the given steps.

    1. On the Macro workbook, go to Developer tab and select Visual Basic from the code section.
      On the Macro workbook, go to the Developer tab and select Visual Basic from the code section
    2. On Microsoft Visual Basic for Applications window, enter Ctrl + R to bring up the Project Explorer menu.
    3. Now, double-click on the Module to check the Macro code. Once you find the VBA code to copy, drag the Module up or down to another Book. Here, we dragged Module 2 of VBAProject(INDIRECT function.xlsx) to VBAProject(Find Lowest Number.xlsx) workbook.
      drag the Module
    4. Finally, you can run the copied Macro. 

    Method 2: Copy the Source Code

    Another method to copy Macros is by using the Copy-Paste Command. When you have a lot of Modules in the VBA, you might have trouble dragging it. So, here, we will copy the VBA code and paste them into a new module.

    Remember, most users tend to miss codes during the selection. You need to make sure to copy the exact code to avoid errors. Do not skip even the punctuation or quotation marks.

    1. Firstly, launch both workbooks. 
    2. On your Macro workbook, enter Alt + F11 shortcut keys to bring up the Visual Basic tool. 
    3. On VBA window, hover over Project Explorer. If you cannot see it, enter Ctrl + R to display the menu.
    4. Click on the Module twice to see the Macro code. Select the Entire code in the Module (From Sub to End Sub).
      Select the Entire code in the Module. (From Sub to End Sub)
    5. Press Ctrl + C to copy the code. 
    6. Then, below the new Workbook, right-click on Module and pick Insert > Module.
      right-click on Module and pick Insert -Module
    7. Now, enter Ctrl + V to paste the code you just copied into the new Module.
      Ctrl + V to paste the code you just copied in the new Module

    Method 3: Use Move or Copy Command

    If you wish to copy the VBA code directly to an exact sheet in a workbook, this method is for you. Here, we will use the Sheet’s Move or Copy Command to create a copy of Macro. To do this, again, you’ll need to open two workbooks first. 

    1. On your workbook, right-click on Sheet with Macro and pick Move or Copy.
      right-click on Sheet with Macro and pick Move or Copy
    2. On Move or Copy Window, expand the drop-down menu for To book and pick a Workbook. 
      On Move or Copy Window, expand the drop-down menu for To book and pick a Workbook
    3. Below Before sheet, select a Sheet name. Tick the box for Create a copy.
      Below Before sheet, select a Sheet name. Tick the box for Create a copy
    4. Click OK.

    Method 4: Export and Import Module File

    In the above three methods, we copied the Macros and pasted them into our own different workbooks. But, some of you may be looking for ways to share a Macro with other users. In that case, you can Export the file of the Macro Module. This method is also handy to store the Macros on your PC and import them into your workbook whenever you need in the future.

    Export Module File

    1. Launch Excel workbook containing Macro.
    2. From Developer Tab, click on Visual Basic in the Code group. Or, press Alt + F11 shortcut key to bring up the Microsoft Visual Basic for Applications window.
    3. On Project Explorer, right-click on the Module and pick Export File.
      On Project Explorer, right-click on the Module and pick Export File
    4. On Export File window, select a location. Enter a Name in the File Name field and hit Save.
      On Export File window, select a location. Enter a name in the File Name field and hit Save

    Import Module File

    1. On your Workbook, enter Alt + F11 for the Microsoft Visual Basic window.
    2. From the Project Explorer panel, right-click on Module and pick Import File.
      From the Project Explorer panel, right-click on Module and pick Import File
    3. Locate the .bas extension file and click Open.
      Locate the .bas extension file and click Open
    4. On Microsoft VBA window, double-click on the Module to see the copied Macro code.
      On Microsoft VBA window, double-click on the Module to see the copied Macro code
    Excel Basics
    Nisha Gurung

      As a Business Student, Nisha first used Excel to outline data trends for her college projects. Later, she started exploring basic Excel functions when she realized it is a powerful tool for all businesses today. Nisha believes she can relate to many of the issues users face when starting their Excel Journey. She uses this knowledge and experience to curate contents that are fit for all types of Excel users. Apart from writing, she enjoys reading books and traveling.

      Related Posts

      Excel By Nisha Gurung

      How to Compare Two Columns in Excel Using VLOOKUP

      Excel By Nisha Gurung

      How to Share Excel Files with Multiple Users

      Excel By Nisha Gurung

      How to Filter Based on a List in Excel

      Add A Comment
      Table of ContentsToggle Table of ContentToggle
      • Method 1: Drag Macro Module
      • Method 2: Copy the Source Code
      • Method 3: Use Move or Copy Command
      • Method 4: Export and Import Module File
      • Home
      • About Us
      • Privacy Policy
      © 2025 Inside The Web

      Type above and press Enter to search. Press Esc to cancel.