We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Create a macro that runs other macros [closed]

asked 2012-06-05 22:50:58 +0200

naomibrown gravatar image


I've recorded some macros and now want to have them all run one after another. Is this possible?

Thanks, Naomi

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-16 15:14:51.747641

1 Answer

Sort by » oldest newest most voted

answered 2012-06-06 10:57:35 +0200

JohnSUN gravatar image

Of course it possible! Just write a new procedure, which will cause the old macros in the right order. You can use the Call statement or simply specify the name of an existing macro. For example, as follows:

Sub myOldMacro1()
End Sub

Sub myOldMacro2()
End Sub

Sub totalСall
  Call myOldMacro1()  ' With Call statement
  For i = 1 to 10
    myOldMacro2()     ' Without Call statement
  Next i
  myOldMacro1()       ' Without Call statement again
End Sub

Every one of your old macros must have a unique name (to know the Basic which of macro is invoked in each case).

edit flag offensive delete link more


Thanks! I've got it done now :)

naomibrown gravatar imagenaomibrown ( 2012-06-07 12:04:06 +0200 )edit

Question Tools

1 follower


Asked: 2012-06-05 22:50:58 +0200

Seen: 4,771 times

Last updated: Jun 06 '12