Marcos to run in current workbook only

Tim Stoner

New Member
Joined
Mar 22, 2020
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Hi All
I am having issues where my macros run across in every book book instead of the current workbook only
I have gone to the macro setting under developer tab and set to the current workbook only but they all keep running on all books
How can I stop this and just have the macros run in the current workbook
Thank you in advance
Tim
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I have always included an optional argument to keep public procedure off the list.

Example:
Public Sub MyMacro1()
Public Sub MyMacro2(Optional HideMacro As Boolean)

Open another workbook. You will not see MyMacro2 in the list of available macros.
Note that it is still available for assignment and calling.
 
Upvote 0
I have always included an optional argument to keep public procedure off the list.

Example:
Public Sub MyMacro1()
Public Sub MyMacro2(Optional HideMacro As Boolean)

Open another workbook. You will not see MyMacro2 in the list of available macros.
Note that it is still available for assignment and calling.
Thank you for this ,but it also doesn't show macros in current workbook, if I use option 2,
I need to assign macro to a ribbon button
Tim
 
Upvote 0
You can still assign it. Add the optional argument after you assign it. It will still call the macro after adding the optional arg.
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,438
Members
449,083
Latest member
Ava19

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