Calling macro "B" from macro "A"

Titian

Well-known Member
Joined
Dec 17, 2004
Messages
567
Is there any way to recognise in macro "B" that it has been called by macro "A" - so that the functionality of macro "B" may be altered?

Macro "B" is also run as a stand-alone program from time to time.

Thanks for your interest.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Thanks James006, however I can't see how this helps.

In macro "A" is a statement "Call macroB" - I would just like macro "B" to realise that it has been called by macro "A".

Hope that clarifies somewhat.
 
Upvote 0
Without your constraints and your underlying reasons, it is not easy to guess your intent ...

You could have a flag (True, False) set by a condition and stored in a public boolean variable ...

HTH
 
Upvote 0
That sounds interesting James006, please tell me how exactly I would create the public boolean variable and then how macro "B" would read that variable.

Thank you.
 
Upvote 0
At the very top of a standard module, you can declare your variable:

Public bcall As Boolean

Then, in your different macros, depending on your conditions you can set the value

bcall = True or bcall = False ...

HTH
 
Upvote 0
Thanks James for your help.

I have something that appears to be working OK in testing, lets see what happens with the real stuff later!

Appreciate your help.
 
Upvote 0

Forum statistics

Threads
1,203,139
Messages
6,053,724
Members
444,681
Latest member
Nadzri Hassan

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