I have set up an if loop, however I want to end a sub test() from finishing, within an If loop. For example

sub test()

if (error =1) then
'get out of sub test and prevent it from finishing
end if


end sub
thanks