Transferring Modules

Submersed

Board Regular
Joined
Jul 6, 2007
Messages
167
Office Version
  1. 365
Platform
  1. Windows
Hi,

I was wondering if it is possible to transfer code that is in a module activated by a button into a sheet?

many thanks
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Why not just call the code in the sheet? You can call sub routines within the sheet code.
 
Upvote 0
The problem is...I copy a few sheets and make a new workbook with them..then i send this workbook to someone but they can't use the macro's because they are all in the modules on the original workbook...So i thought if they are in the sheets wouldn't that work??
 
Upvote 0
I'm not positive that the code would transfer with the copy. I know that code on sheets can be picky at times on what you can do. Sometimes the code has to be in a module to work properly. You can export modules and e-mail them the module and then they can import it into the workbook. There may even be a way through VBA to export a module, but I do not know it.
 
Upvote 0
Why not create a copy of the workbook, then delete the unneeded worksheets from the copy and send that.

The code should be intact if you do that.
 
Upvote 0
is there some code that will copy the enitre workbook then??

when I just copy all the sheets into a new workbook...the modules don't go along with it...
 
Upvote 0
You can manually Save As, or make a copy in Windows Explorer. Or in code:

ActiveWorkbook.SaveAs "C:\temp\Copy1.xls"

or

ActiveWorkbook.SaveCopyAs "C:\temp\Copy2.xls"

SaveAs changes the active workbook to Copy1.xls, while SaveCopyAs keeps the original workbook as the active workbook.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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