View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Corey[_2_] Corey[_2_] is offline
external usenet poster
 
Posts: 16
Default How to Stop a Macro if a 'Call' macro was used


I do nto know how i can place an IF condition though.

I use a :
Sub CommandButton2_Click()
'code blah blah blah
........
Call Macro1
end Sub

How would i place a condition in the Call Macro1 to Exit the CommandButton
Sub IF the Macro1 Changes something?

Corey....

"Susan" wrote in message
...
you'd have to code in the condition..........

if <condition then
exit sub
end if

when it exits then it would go back to the first macro that called
it. once it's in the middle of running the only way to break out of
it is Ctrl+Break.
hth
:)
susan



On Jul 30, 7:25 am, "Corey" wrote:
Is ther a way to Cancel a CommandButton on a form via a Module Sub Routine
?

I can have :
Userform1.CommandButon2.Cancel
but it does not STOP the macro from running that called the other macro in
the module, but returns an error.

Is ther a way to STOP/CANCEL a CommandButton continuing from a Module
code?

Corey....