I have a method-A() that is called from multiple methods,
On a condition in method-A, i have to terminate the macro.
i saw one option as Exit sub but this will just exit the current sub ie:method-A() and the remaining program continues.
how to handle this.
Sub mainMethod()
method-A()
end Sub
Sub method-A()
if (true) Then
'Terminate the macro. that is exit method-A() and also mainMethod()
end Sub
Edit after comment:
Just use
endwhere you want to terminate ALL code.Original Answer: All you need to do is make methodA a function and return this function as FALSE if you want to exit the main method as per the following code: