Copy Macros from a file to another file

%3CLINGO-SUB%20id%3D%22lingo-sub-2160694%22%20slang%3D%22en-US%22%3ECopy%20Macros%20from%20a%20file%20to%20another%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2160694%22%20slang%3D%22en-US%22%3E%3CP%3EHello%3C%2FP%3E%3CP%3EI've%20tried%20to%20copy%20Macros%20from%20an%20Excel%20File%20into%20another%20Excel%20File%2C%20both%20opened%2C%20using%20VBA%2C%20but%20without%20success%3B%20on%20the%20Explorer%2C%20I%20can%20see%20the%20sheets%20of%20each%20File%2C%20by%20their%20name%2C%20but%20the%20Modules%20are%20just%20numbered%2C%20no%20names%3B%20thus%20I%20don't%20know%20what%20represents%20each%20Module%2C%20and%20cannot%20copy%20and%20paste%20either.%3C%2FP%3E%3CP%3EIn%20fact%20I've%202%20Files%20with%20different%20data%20(sheets%2B%20macros)%20but%20would%20like%20to%20have%20everything%20in%20a%20single%20file%20for%20more%20interaction%20(size%206MB%20one%2C%202MB%20the%20other)%3C%2FP%3E%3CP%3EHope%20this%20is%20clear.%3C%2FP%3E%3CP%3EAppreciate%20if%20somebody%20can%20help%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3EBest%20Regards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2160694%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2160728%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20Macros%20from%20a%20file%20to%20another%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2160728%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F976623%22%20target%3D%22_blank%22%3E%40JorgeLx%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20double-click%20a%20module%20in%20the%20Project%20Explorer%20pane%20of%20the%20Visual%20Basic%20Editor%20to%20inspect%20its%20contents.%20One%20module%20can%20contain%20multiple%20macros%20and%20functions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20copy%20a%20module%20from%20one%20open%20workbook%20to%20another%20by%20dragging%20and%20dropping%20it%20in%20the%20Project%20Explorer%20pane.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello

I've tried to copy Macros from an Excel File into another Excel File, both opened, using VBA, but without success; on the Explorer, I can see the sheets of each File, by their name, but the Modules are just numbered, no names; thus I don't know what represents each Module, and cannot copy and paste either.

In fact I've 2 Files with different data (sheets+ macros) but would like to have everything in a single file for more interaction (size 6MB one, 2MB the other)

Hope this is clear.

Appreciate if somebody can help

Thanks in advance

Best Regards

2 Replies

@JorgeLx 

You can double-click a module in the Project Explorer pane of the Visual Basic Editor to inspect its contents. One module can contain multiple macros and functions.

 

You can copy a module from one open workbook to another by dragging and dropping it in the Project Explorer pane.

@Hans Vogelaar 

 

Hi Hans

 
great help.
It works fine;
had to rework a couple of things, like redefine location of Macros on new file, search right modules to transfer, but it definitely saved me a lot more of work.
 
Thank you very much

Regards