Copy Macros from a file to another file

Copper 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