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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

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,792
Office Version
  1. 365
Platform
  1. Windows
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,302
Messages
5,836,504
Members
430,436
Latest member
fefenouil

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
Top