Knowledge Base

Custom Function Returns Incorrect Value/Appears to Hang

Article ID: 125723

Article Last Modified on 10/11/2006


APPLIES TO


This article was previously published under Q125723

SYMPTOMS

In Microsoft Excel, when you use a custom function, the function may return an incorrectly calculated value, or, during recalculation, the function may appear to hang your computer (to return control to your Microsoft Excel, press the ESC key).

CAUSE

This problem occurs under the following conditions:

  • The custom function relies on another custom function for at least one of its arguments. -and-

  • In the declaration line for the custom function, the function arguments have not been declared with data types, as in the following example:
          Function Test (arg) As Integer</WWITEM></WWSTEPS>
    						

WORKAROUND

To ensure that Microsoft Excel calculates the custom function properly, add the expected data types for all arguments when you declare the function. For the example, change the function
   Function Test (arg)
				

to:

   Function Test (arg As Integer)
				

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

Additional query words: 5.00a 5.00c 7.00a XL98 XL97 XL7 XL5 XL

Keywords: kbprb kbprogramming KB125723