I'm very inexperienced in Excel and I'm running into a problem programming a macro. It simply stops without any error dialog, no matter whether I set a breakpoint and step over or not.
Am I missing something? Do I have to turn on error messages explicitly?
Something like this, in a module:
Function Provoke(XYZ As Integer) As Integer
Provoke = XYZ / 0
End Function
The Function is used in a formula inside of a cell, like this
=Provoke(4711)
How can I make it complain about the division by zero?
If an error occurs in a Function when called from a worksheet as a UDF, you won't see any error messages- you just get a #VALUE error returned to the cell(s)
If you call that same function from a Sub in VBA, you will see the error.
If you want to be able to return more-specific error messages you'll need to to a little more coding.
E.g.
A good reference for this: http://www.cpearson.com/excel/ReturningErrors.aspx