transfer both macro and worksheet to other workbook

jammoca

Banned
Joined
Nov 6, 2002
Messages
1,100
I have a sheet that I want to transfer over to another workbook .. easy enough.

But on that sheet I have three command buttons that each use a different macro to do what they do to cells on that sheet being transferred.

However, the macros are stored in modules and these don't transfer across of course when I transfer the sheet.

Is there a way I can easily transfer both the sheet as well as the three modules or macros together ?
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

preludeofme

New Member
Joined
Dec 4, 2008
Messages
34
you will want to export the modules to your hard drive and then create a macro that will open the new spreadsheet, import those macro files, create the buttons, and link the macros to the buttons. i will try to remember to post a script i put together for a similar project when i get home.

otherwise just google search (or on these forums) search "how to import modules via VBA" should find something to help
 

Ruddles

Well-known Member
Joined
Aug 24, 2010
Messages
5,785
If it's just a one-off, right-click each module name in your source workbook in turn and Export file.

Then go to your target workbook and right-click Microsoft Excel Objects, and Import file for each of the modules.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,330
Messages
5,528,043
Members
409,799
Latest member
mlewan_ca

This Week's Hot Topics

Top