How to Kill a vba macro from a Function//
I'd pass back the results of the function. Kind of like:
sub testme
dim OkToContinue as boolean
okTocontinue = dosomething(activesheet.range("a1:A10"))
if oktocontinue = false then
exit sub
end if
oktocontinue = dosomethingelse(...)
'....
end sub
function dosomething(rng as range) as boolean
dim res as long
'do something
res = msgbox(prompt:="continue?",buttons:=vbyesno)
if res = vbyes then
dosomething = true
else
dosomething = false
end if
end function
coco wrote:
This macro check all cells in columns A; in my VBA a Module call a Function
and it runs after all cell values in column A has been checked. During the
process It prompts with a MsgBox if this cell has errors ONLY (this MsgBox is
inside this Function).
if this CELL has errors. I want to add in this MsgBox an option to:
Yes:GOTO cell with errors and then CLOSE vba macro OR
No: continue with the loop checking all values in column A.
My question is:
There is a command that I can put inside a function to kill or force the
Macro to end?
I tried
"End Function"
but it kills only the function and not the entire forms (3 forms)
Thanks
Coco
--
Dave Peterson
|