Knowledge Base

XL98: Custom Function Returns #VALUE! Error After Running Macro

Article ID: 180370

Article Last Modified on 9/12/2006


APPLIES TO


This article was previously published under Q180370

SYMPTOMS

If you call a user-defined (custom) function from a worksheet formula, and then run a Microsoft Visual Basic for Applications macro, the user-defined function may return the #VALUE! error.

CAUSE

This problem occurs if all of the following conditions are true:
  • You create a custom function, and then call it from a worksheet formula.

    -and-
  • The custom function uses the Text property for a Range object.

    -and-
  • You run another Sub procedure (macro) that deletes a row in the worksheet.

WORKAROUND

To work around this problem, use the Value property instead of the Text property in the custom function.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

You can use the Text property or the Value property with a Range object. The Value property returns the actual underlying cell value, while the Text property returns the formatted value that is displayed in the cell.

Additional query words: XL98 vba

Keywords: kbbug KB180370