XL5: "Error in Formula" Using FormulaArray Property

ID: Q121323

5.00 WINDOWS kbprg kberrmsg

The information in this article applies to:

SYMPTOMS

In Microsoft Excel, when you use the FormulaArray property in a Visual Basic procedure to enter a formula as an array, you receive the following error message:

   Run-time error '1005':

   Error in formula

CAUSE

You receive this error message when you use the A1 reference style in the value of the FormulaArray property. For example, you receive this error message when you run a procedure that contains the following statement:

   Range("A2").FormulaArray = "=Sum(B1:B2)"

Note that you can use either the A1 reference style, or the R1C1 reference style in the Formula property, which is similar to the FormulaArray property.

WORKAROUND

To avoid receiving this error message when you use the FormulaArray property, use the R1C1 reference style for references, as in the following example:

   Range("A2").FormulaArray = "=Sum(R1C2:R2C2)"

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel version 5.0c for Windows.

MORE INFORMATION

You can use the FormulaArray property to return or set the formula of a range, entered as an array. The property returns or enters a single formula or a Visual Basic array.

You can use the Formula property to return or enter a formula for a range of cells, or for an object.

REFERENCES

For more information about the FormulaArray Property, choose the Search button in the Visual Basic Reference and type:

   FormulaArray Property

KBCategory: kbprg kberrmsg KBSubcategory:

Additional reference words: 1.00 5.00 err msg

Version           : 5.00
Platform          : WINDOWS

Last Reviewed: December 21, 1996