Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default how to create a macro that runs other macro in the same workbook

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 9
Default how to create a macro that runs other macro in the same workbook

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


"VB Script for Excel" wrote in message
oups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default how to create a macro that runs other macro in the same workbook

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
--
Kevin Backmann


"VB Script for Excel" wrote:

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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default how to create a macro that runs other macro in the same workbook

why would it be step0() ? or is that step1()?

Thnx

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default how to create a macro that runs other macro in the same workbook

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
One macro runs then it auto runs another macro PG Excel Discussion (Misc queries) 2 September 1st 06 09:30 PM
Macro runs in source , but not when in Personal Macro Workbook Darin Kramer Excel Programming 1 September 13th 05 04:48 PM
Excel Workbook automatically (by design) runs a macro Paul Excel Programming 0 August 5th 04 10:49 PM
Excel Workbook automatically (by design) runs a macro Chip Pearson Excel Programming 0 August 5th 04 08:24 PM


All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"