Expand Minimize

NamedRange.FormulaLabel Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets or sets the formula label type for the NamedRange control.

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

XlFormulaLabel FormulaLabel { get; set; }

The return value of this property can be xlNone if the NamedRange control contains no labels, or one of the following XlFormulaLabel values:

The following code example uses the FormulaLabel property to specify that column labels can be used in formulas, and then creates a formula that uses a column label in a NamedRange.

This example is for a document-level customization.

private void ShowFormulaLabel()
{
    Globals.ThisWorkbook.AcceptLabelsInFormulas = true;

    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1", "A4"],
        "formualArrayRange");
    namedRange1.FormulaLabel =
        Excel.XlFormulaLabel.xlColumnLabels;

    this.Range["A1"].Value2 = "Product Sales";
    this.Range["A2"].Value2 = 11;
    this.Range["A3"].Value2 = 22;
    this.Range["A4"].Formula = "=Sum(Product Sales)";
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft