Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

how to create a macro that runs other macro in the same workbook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
VB Script for Excel - 23 Mar 2006 03:35 GMT
I have a workbook that has 4 macros. Macros are named as "Step1",
"Step2", "Step3", "Step4".
How can I create a macro in the same file that would run Step1 to Step
4 in consecutive order?

Thanks
Dhaval K
MD - 23 Mar 2006 03:58 GMT
Sub step0()

Application.Run (MyWorkbook.xls!step2)
Application.Run (MyWorkbook.xls!step2)
Application.Run (MyWorkbook.xls!step3)
Application.Run (MyWorkbook.xls!step4)

End Sub

Sub step1()

End Sub

Sub step2()

End Sub

and so on

>I have a workbook that has 4 macros. Macros are named as "Step1",
> "Step2", "Step3", "Step4".
[quoted text clipped - 3 lines]
> Thanks
> Dhaval K
VB Script for Excel - 23 Mar 2006 04:43 GMT
why would it be step0() ? or is that step1()?

Thnx
VB Script for Excel - 23 Mar 2006 04:53 GMT
Also, instead of putting the name of the workbook (MyWorkbook.xls), can
i put a name that refers to this workbook? This is because if i change
the filename tomrrow, the macro wouldn't work.

If i use this:
Set z = activeworkbook
Application.Run (z!step1)
and so on
End Sub

This doesn't work. It says cannot find file z.

Thanks again.
Kevin B - 23 Mar 2006 03:59 GMT
Open the VB editor and create a macro named whatever, and then just list the
macro names, one per line, in the order you want them to run

Sub RunEmAll()

   Step1
   Step2
   Step3
   Step4

end sub
Signature

Kevin Backmann

> I have a workbook that has 4 macros. Macros are named as "Step1",
> "Step2", "Step3", "Step4".
[quoted text clipped - 3 lines]
> Thanks
> Dhaval K
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.