Stop running a macro in the middle of a macro

G

gmunro

Hi,

I have a macro that runs another macro in it, something like this

Sub mymacro ()
code

Myothermacro

code

End sub
Sub Myothermacro()

Msgbox
If no then
Exit Sub
End if
End Sub


When I run the macro, if the answer is NO, it ends Myothermacro but
then resumes mymacro.

How can I have a messagebox in Myothermacro have a DEAD STOP and return
to sheet?

Any help is appreciated
 
T

Tom Ogilvy

Sub mymacro ()
code

If Myothermacro Then

code
End if

End sub


Function Myothermacro()

Msgbox
If no then
MyOtherMacro = False
else
MyOtherMacro = True
End if
End Function
 
C

Chris Ferguson

How about dim public StopFlag

set the stopflag in your second macro and test for it on return to your
first macro

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top