|
|
Question : VBA: Terminate master (calling) sub
|
|
Hi Everybody: Here is one more newbie question.
I am calling procedure/sub and want to terminate the both procedure, if condition is true.. like
sub master()
some code here
call DataCheck
some more code here
end sub
sub DataCheck()
if x = true then
end sub ' I want to terminate both sub here end if
end sub
I try to use end sub, but it give me error message if without end if....
what is the best way to terminate both sub
Thanking you in advance
|
Answer : VBA: Terminate master (calling) sub
|
|
make datacheck a function that returns false if it's going to exit and then use that value in master
sub master() some code here if not DataCheck() then exit sub some more code here end sub
function DataCheck() as boolean
if x = true then DataCheck = false exit function end if DataCheck = true end function
|
|
|
|