title: Excel: Break on Error doesn't work in user-defined function
body: <p>It seems that when VBA code is called from a cell formula (ie. a "User Defined Function" or UDF), the usual VBA Break On Error doesn't work. </p>
  
  <p>The only place I can find this behavior documented is a couple of lines in an article called <a href="http://msdn.microsoft.com/en-us/library/bb226683%28v=office.12%29.aspx">"Developing User-Defined Functions for Excel 2007 and Excel Services"</a>:</p>
  
  <blockquote>
    <p>Error handling returns #VALUE errors. All exceptions thrown by the UDF code are returned into the Excel worksheet as #VALUE errors.</p>
  </blockquote>
  
  <p>Even if you set Error Trapping to "Break on All Errors" and single-step your code**, you will never see the VBA Run-time Error dialog - Excel just quietly abandons execution without telling you what went wrong. Of course this makes debugging more difficult than it needs to be.</p>
  
  <p>There are some potential workarounds involving <code>On Error</code> but I'd rather not clutter up my code just to find out where an error was raised.</p>
  
  <p>Is there some Excel / VBA option I've overlooked which will make Break On Error work normally? I'm using Excel 2003.</p>
  
  <p>** The only way to get into the debugger when called from a cell is to set a breakpoint or use a <code>Stop</code> statement</p>