Udostępnij za pośrednictwem


NamedRange.FormulaArray Property (2007 System)

Gets or sets the array formula of the NamedRange control.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property FormulaArray As Object
'Usage
Dim instance As NamedRange 
Dim value As Object 

value = instance.FormulaArray

instance.FormulaArray = value
[BrowsableAttribute(false)]
public Object FormulaArray { get; set; }
[BrowsableAttribute(false)]
public:
property Object^ FormulaArray {
    Object^ get ();
    void set (Object^ value);
}
public function get FormulaArray () : Object 
public function set FormulaArray (value : Object)

Property Value

Type: System.Object
The array formula of the NamedRange control.

Remarks

This property returns (or can be set to) a single formula or an array.

If the NamedRange control does not contain an array formula, this property returns nulla null reference (Nothing in Visual Basic).

If you use this property to enter an array formula, the formula must use the R1C1 reference style, not the A1 reference style.

Examples

The following code example creates a NamedRange and then uses the FormulaArray property to set the value of the NamedRange to equal the sum of the array of cells A1 through A3.

This example is for a document-level customization.

Private formualArrayRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub SetFormulaArray()
    formualArrayRange = Me.Controls.AddNamedRange( _
        Me.Range("B1"), "formualArrayRange")
    Me.Range("A1", "A3").Value2 = 3333
    Me.formualArrayRange.FormulaArray = "=Sum(R1C1:R3C1)" 
End Sub
Microsoft.Office.Tools.Excel.NamedRange formualArrayRange;
private void SetFormulaArray()
{
    formualArrayRange = this.Controls.AddNamedRange(
        this.Range["B1", missing], "formualArrayRange");
    this.Range["A1", "A3"].Value2 = 3333;
    this.formualArrayRange.FormulaArray = "=Sum(R1C1:R3C1)";
}

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace