ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do I create a macro that will activate other macros? (https://www.excelbanter.com/excel-programming/402201-how-do-i-create-macro-will-activate-other-macros.html)

sbrigham

how do I create a macro that will activate other macros?
 
I am trying to create a Macro that will click on controls that have macros
assigned, this isn't working so I want to know if there is a way to nest the
sub's into this macro.

John Bundy

how do I create a macro that will activate other macros?
 
If you will put your macro's as functions or subs into a module (right click
your project and insert module) then you can call them from anywhere. example
Function CountStuff()
code
End Function
then under your click event,and anywhere else, just call CountStuff() and it
will run that code.

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"sbrigham" wrote:

I am trying to create a Macro that will click on controls that have macros
assigned, this isn't working so I want to know if there is a way to nest the
sub's into this macro.


Jim Thomlinson

how do I create a macro that will activate other macros?
 
The standard way to do this is not to click on the other controls but rather
to run the code associated with those controls. So something like this...

sub LotsOfStuff()
Call DoThis
Call DoThat
end sub

sub DoThis()
msgbox "do this"
end sub

sub DoThat
msgbox "do that"
end sub

--
HTH...

Jim Thomlinson


"sbrigham" wrote:

I am trying to create a Macro that will click on controls that have macros
assigned, this isn't working so I want to know if there is a way to nest the
sub's into this macro.


sbrigham

how do I create a macro that will activate other macros?
 
Thank you! I was missing the call part.

"Jim Thomlinson" wrote:

The standard way to do this is not to click on the other controls but rather
to run the code associated with those controls. So something like this...

sub LotsOfStuff()
Call DoThis
Call DoThat
end sub

sub DoThis()
msgbox "do this"
end sub

sub DoThat
msgbox "do that"
end sub

--
HTH...

Jim Thomlinson


"sbrigham" wrote:

I am trying to create a Macro that will click on controls that have macros
assigned, this isn't working so I want to know if there is a way to nest the
sub's into this macro.



All times are GMT +1. The time now is 03:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com