Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Run a macro within a macro

How can you execute a macro within another macro.

Example: Run macro a in macro b. Cutting and pasting does not seem to work.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Run a macro within a macro

Sub hello()
Call boxit
End Sub

Sub boxit()
MsgBox ("in boxit")
End Sub
--
Gary's Student


"norrislaketn" wrote:

How can you execute a macro within another macro.

Example: Run macro a in macro b. Cutting and pasting does not seem to work.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Run a macro within a macro

Something like this..

Sub Macro1()
msgbox "macro1"
call Macro2
exit sub

Sub Macro2()
msgbox "macro2"
exit sub


--
HTH...

Jim Thomlinson


"norrislaketn" wrote:

How can you execute a macro within another macro.

Example: Run macro a in macro b. Cutting and pasting does not seem to work.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Run a macro within a macro

Sub Macro1()
Msgbox "Macro1"
' some code
Macro2
End Sub

Sub Macro2()
Msgbox "Macro2"
' some code
Macro3
Macro4
End Sub

Sub Macro3()
Msgbox "Macro3"
' some code
End Sub

Sub Macro4()
Msgbox "Macro4"
' some code
End Sub

Regards

Trevor


"norrislaketn" wrote in message
...
How can you execute a macro within another macro.

Example: Run macro a in macro b. Cutting and pasting does not seem to
work.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Run a macro within a macro

Thanks for the info. Your solution will run if I step into it. If I run ir
directly from the macro shortcut key it does not run. It acts as if it is
executing the next command before the call is complete. Any other thoughts?

"Gary''s Student" wrote:

Sub hello()
Call boxit
End Sub

Sub boxit()
MsgBox ("in boxit")
End Sub
--
Gary's Student


"norrislaketn" wrote:

How can you execute a macro within another macro.

Example: Run macro a in macro b. Cutting and pasting does not seem to work.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Run a macro within a macro

Thanks for the info. Your solution will run if I step into it. If I run ir
directly from the macro shortcut key it does not run. It acts as if it is
executing the next command before the call is complete. Any other thoughts?


"Trevor Shuttleworth" wrote:

Sub Macro1()
Msgbox "Macro1"
' some code
Macro2
End Sub

Sub Macro2()
Msgbox "Macro2"
' some code
Macro3
Macro4
End Sub

Sub Macro3()
Msgbox "Macro3"
' some code
End Sub

Sub Macro4()
Msgbox "Macro4"
' some code
End Sub

Regards

Trevor


"norrislaketn" wrote in message
...
How can you execute a macro within another macro.

Example: Run macro a in macro b. Cutting and pasting does not seem to
work.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Run a macro within a macro


Thanks for the info. Your solution will run if I step into it. If I run ir
directly from the macro shortcut key it does not run. It acts as if it is
executing the next command before the call is complete. Any other thoughts?

"Jim Thomlinson" wrote:

Something like this..

Sub Macro1()
msgbox "macro1"
call Macro2
exit sub

Sub Macro2()
msgbox "macro2"
exit sub


--
HTH...

Jim Thomlinson


"norrislaketn" wrote:

How can you execute a macro within another macro.

Example: Run macro a in macro b. Cutting and pasting does not seem to work.


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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 12:40 PM.

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

About Us

"It's about Microsoft Excel"