how to use same vba code/script for different excel file/workooks?

ladydee94

New Member
Joined
Feb 27, 2017
Messages
9
Hi, I'm really new in excel macro and VBA. i need help how to use the same vba code/script on different/multiple excel file/workbooks?

for example, in file 1 there is code or script on module. so when i close file 1, i open new workbook and want use the same code/script on module of file 1.

i have heard about "personal macro workbook", but i still confuse and lost how to use it. i already tried record dummy macro, then select Personal Macro Workbook under the Store The Macro in drop-down list. then i save my code in that personal macro. but when close all workbook, then open new sheet, i assign macro on button, but the personal macro doesn't show in macro list. i kind of in really confuse situation now. i really appreciate any help from all of you. thank you.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Good morning ladydee,
All you need to do is to Export the Module out from File1, then open File2 (new Workbook) and Import the Module, you can achieve this by

  1. Right-clicking the module then "Export file ...",
  2. Browse the location you want to save the Module in, then say "Save"
  3. go to the File2 (new Workbook), open its vba project, and hit CTRL+m or File Menu >>> "Import File ..."
  4. Browse to the location where you previously saved you module, and that's it, you module shows up in your new Workbook!!!
  5. All you will have to do now is making calls to the subs it contains.

Regards.
 
Upvote 0
Good morning ladydee,
All you need to do is to Export the Module out from File1, then open File2 (new Workbook) and Import the Module, you can achieve this by

  1. Right-clicking the module then "Export file ...",
  2. Browse the location you want to save the Module in, then say "Save"
  3. go to the File2 (new Workbook), open its vba project, and hit CTRL+m or File Menu >>> "Import File ..."
  4. Browse to the location where you previously saved you module, and that's it, you module shows up in your new Workbook!!!
  5. All you will have to do now is making calls to the subs it contains.

Regards.

Thank you XLRATOR for your help. it really help me in simple way. :)
 
Upvote 0
Hi XLRATOR, I have something to ask, how about other way to use the same code/script on new workbook? because this workbook will be use by other staff, so to make it easier for them to using shortcut or etc?
 
Upvote 0
As simple as it is to share the exported file with your loved ones :)
Go to the location you exported the module in, it is a "*.bas" file, copy and share the way you like (E-mail, Usb, Facebook, whatever ...), just let them know the way you did to import it.

Regards.
 
Upvote 0

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

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