ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy a complete modulesheet from file to another file (https://www.excelbanter.com/excel-programming/454454-copy-complete-modulesheet-file-another-file.html)

JS SL

Copy a complete modulesheet from file to another file
 
Hello,

I see some difficult examples for copying a complete modulesheet from file to file. Perhaps somebody knows the best/easiest way.

I have a MASTER.xlsm (macro enabled) file. This file contains a modulesheet called BasicToCopy. This is the modulesheet I want to copy to another created file. Included is also another modulesheet which should contain the macro which can copy the sheet 'BasicToCopy' to the other file.

When I create a new xls file I want to copy the modulesheet 'BasicToCopy' from file MASTER.xlsm to this new created file (and then a have to save this file also as a xlsm file, but that is a manualy action because I have to think a file name).

So.... I have 2 open files. 1= My new created file, 2= MASTER.xlsm with 2 modulesheets (the one with the copy commandos, one with the to copy module).

When running the macro, then my new file is the active file;
1. Set ActiveFileName in memory.
2. GoTo MASTER.xlsm and copy module sheet 'BasicToCopy'
3. Back to the active file from step 1.
4. Insert/Paste the complete module 'BasicToCopy' in the file from step 1.

Thats all :)

But know in a working code.
So if somebody things... yes, this is a nice one to create. Feel free (and make me happy).

regards, Johan


GS[_6_]

Copy a complete modulesheet from file to another file
 
You can drag-n-drop modules from one file to another in the VBE!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

GS[_6_]

Copy a complete modulesheet from file to another file
 
You can drag-n-drop modules from one file to another in the VBE!

Also, if you save all the code in a template file you can start new files based
on that template; - they'll have everything in place from the get-go!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

GS[_6_]

Copy a complete modulesheet from file to another file
 
You can drag-n-drop modules from one file to another in the VBE!

IOW:
Save your Master.xlsm as Master.xltm and use it as the template to create new
workbooks from...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


All times are GMT +1. The time now is 05:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com