ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to run a macro in code (https://www.excelbanter.com/excel-programming/331829-how-run-macro-code.html)

Man Utd

How to run a macro in code
 
After I created a macro, how do I run this macro in code ?



Snake Plissken[_2_]

How to run a macro in code
 
sub created_makro()

'bla bla

end sub


sub other_macro()

call created_makro

end sub


is that what u looking for?

After I created a macro, how do I run this macro in code ?



dominicb[_27_]

How to run a macro in code
 

Good morning Man Utd (???)

...or if you're feeling really lazy you can miss out the "Call".

Sub other_macro()
created_makro
End Sub

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=379257


keepITcool

How to run a macro in code
 

exactly the OP's point

other_macro will give compile error
if created_macro does not exist.

use
application.run thisworkbook.name & "!created_macro"

make sure created_macro is not private.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Snake Plissken wrote :

sub created_makro()

'bla bla

end sub


sub other_macro()

call created_makro

end sub


is that what u looking for?

After I created a macro, how do I run this macro in code ?



Man Utd[_2_]

How to run a macro in code
 
Sorry for my lack of macro knowledge, I think macro is a sort of
function/procedure.
What I need to do is:
When I fill in the cell in worksheet A, eg. B3 has value "Peter", I will
call a macro/function/procedure to search through a range of cells in
worksheet B, eg. A2:D200, if I find the matched value in column A is also
"Peter", eg A10, then I need to fetch the values of B10, C10, D10, fill in
the worksheet A cells C3, D3, E3 from the corresponding row in the worksheet
B of the matched value.

"keepITcool" wrote in message
ft.com...

exactly the OP's point

other_macro will give compile error
if created_macro does not exist.

use
application.run thisworkbook.name & "!created_macro"

make sure created_macro is not private.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Snake Plissken wrote :

sub created_makro()

'bla bla

end sub


sub other_macro()

call created_makro

end sub


is that what u looking for?

After I created a macro, how do I run this macro in code ?





keepITcool

How to run a macro in code
 

i think you are a recent visitor to this newsgroup/forum
and I also think you are just discovering excel
IMO for the moment you should stick to formulas and functions...

this NG is concerned with VBA/programming/macros.

try a different group:
try microsoft.public.excel.worksheetfunctions

VanTheMan!!!

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Man Utd wrote :

Sorry for my lack of macro knowledge, I think macro is a sort of
function/procedure.
What I need to do is:
When I fill in the cell in worksheet A, eg. B3 has value "Peter", I
will call a macro/function/procedure to search through a range of
cells in worksheet B, eg. A2:D200, if I find the matched value in
column A is also "Peter", eg A10, then I need to fetch the values of
B10, C10, D10, fill in the worksheet A cells C3, D3, E3 from the
corresponding row in the worksheet B of the matched value.

"keepITcool" wrote in message
ft.com...

exactly the OP's point

other_macro will give compile error
if created_macro does not exist.

use
application.run thisworkbook.name & "!created_macro"

make sure created_macro is not private.


--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



Snake Plissken wrote :

sub created_makro()

'bla bla

end sub


sub other_macro()

call created_makro

end sub


is that what u looking for?

After I created a macro, how do I run this macro in code ?




All times are GMT +1. The time now is 04:17 PM.

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