Monday, December 2, 2013

Copy Macro to a Workbook

We are recording a simple macro or developing a macro to automate our tasks in excel. Sometimes we need to copy them to another workbook. Let's see how we can perform this action.

Copy The Macro. (If you copied the macro from internet or other source you can skip this section)

Go to Developer tab in the workbook which you have macro to be copied. (If you can't see developer tab, check this post 'Display Developer Tab'.) There You can see "Code" subgroup and "Visual Basic" as the first option. Click on it to open the VBA editor.

Insert Module
Right side of this window you can see the list of excel workbooks open at the time and list of sheets, List of forms in a workbook & list of modules in a  workbook. Find the module which is going to copy and double click on it. Now you can see the code. Select and copy all lines of the code. (Hope this module is not linked with any other module in the workbook. If you have any doubt about it, please get support from experts. Otherwise copied macro will not work properly.)

Paste the Macro

Go to Developer tab in the workbook which you have macro to be copied. (If you can't see developer tab, check this post 'Display Developer Tab') There You can see "Code" subgroup and "Visual Basic" as the first option. Click on it to open the VBA editor.
Paste Module

Click on insert button on the VBA editor and select 'Module'. Paste the code copied by you. Save the workbook with the macro as macro enabled workbook. (If you don't know how to check this post 'Save Your Macro'.)

No comments:

Post a Comment

Featured Post

XLOOKUP in Excel: The Ultimate Guide to Dynamic Data Lookup

Excel is a powerful tool for analyzing data, but sometimes finding specific data points can be a headache-inducing task. That's where XL...