By using listi.net you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

listi.net

 


On Error Resume Next Problem

the following logic can be problematic

On Error Resume Next
If range("name") = 22 then
   DoSomething
else
   DoSomethingElse
End if

If the range("name") is in error (#NA, #VALUE, #NAME, #DIV/0 etc.) the next line after the "if" will be executed. Instead use:

On Error Resume Next
x = range("name")
if err = 0 then
   if x = 22 then
      DoSomething
   else
      DoSomethingElse
   end if
else
   DoErrorCode
end if
blog comments powered by Disqus