Expand Minimize
This topic has not yet been rated - Rate this topic

NamedRange.Precedents Property

Gets a Range that represents all the precedents of the NamedRange control.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Range Precedents { get; }

Property Value

Type: Range
A Range that represents all the precedents of the NamedRange control.

This can be a multiple selection (a union of Range objects) if there is more than one precedent.

The following code example sets a reference in cell A2 to refer to cell A1, and then sets a reference in a NamedRange to refer to cell A2. The code example then uses the Precedents property to select the precedents of the NamedRange, which are cells A1 and A2.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange precedentsRange;
private void SelectPrecedents()
{
    precedentsRange = this.Controls.AddNamedRange(
         this.Range["C1"], "precedentsRange");

    this.Range["A1"].Value2 = "1710";
    this.Range["A2"].Value2 = "=A1";

    this.precedentsRange.Value2 = "=A2";
    this.precedentsRange.Precedents.Select();
}
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.