Solved
Werner_EAnswer
25-Diamond I
February 7, 2018
You are using "on error" the wrong way.
It has to be the first statement (otherwise the error occurs and your routine fails) and calculation which may fail is on the RHS, not the LHS.
The following should do the job, but on first sight it looks to me that the value of M does not influence the result.


