Can I save a macro to a specific workbook?

Lloydmp

New Member
Joined
Jan 2, 2018
Messages
11
Hi there,

For clarification what I am looking to do is to try and save the macro to the work book so others who use it don't have to import the macro.
I managed to add an auto lookup macro to the ThisWorkBook in VBA but that applies the macro when you open the workbook.
I want a button or alternative to save & email the Workbook. I already have a functioning code but no idea at all if i can apply it the ThisWorkBook

Thanks in advance!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
If you are running a macro off a button then the macro should be in a regular module not the ThisWorkbook module.
 
Last edited:
Upvote 0
Doesn't have to be a button, just some what to apply macro after you have edited Workbook.
Is this at all possible?
 
Upvote 0
I don't understand what you are asking...
You write you macro in a regular module (in the VB editor click Insert then module), put a forms commandbutton on the worksheet, an assign macro dialog box appears (if it doesn't right click the button and click assign macro), you select your macro and click ok, save as a macro enabled file type i.e. xlsm, xlsb etc.
 
Upvote 0
"For clarification what I am looking to do is to try and save the macro to the work book so others who use it don't have to import the macro."

Like i said above, the people I'm trying to help are not computer literate and I'm trying to save the macro to the workbook so no matter what PC the wok book is opened from the macro doesn't need to be imported its simply with the work book.

Is this possible for a macro that needs to be activated when i choose instead of when the workbook is opened?
 
Upvote 0
They don't import the macro whether it is in the ThisWorkbook or a regular module as you long as you have saved it as a macro enabled file type.

Why do you think they would need to import the macro?
 
Upvote 0
So as long as i create/edit/save a work book and ensure its macro enabled the macros will be available for another user on another PC?

Honestly didn't know it worked like this!
 
Upvote 0
So as long as i create/edit/save a work book and ensure its macro enabled the macros will be available for another user on another PC?

Honestly didn't know it worked like this!

Yes but it is the file type that is macro enabled, if it is an xlsx file type then it can't hold a macro (just make sure you are putting the macro in the workbook you are sending and not in your personal workbook).
 
Upvote 0
I have been creating all my macros in personal workbook. This has changed so much of what iv been doing. thank you very very much for this!
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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