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 ?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,704
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top