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

NamedRange.DirectPrecedents Property (2007 System)

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

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
[BrowsableAttribute(false)]
public Range DirectPrecedents { get; }

Property Value

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

This property can return a multiple selection (a union of Range objects) if there is more than one dependent.

This property only works on the active sheet and cannot trace remote references.

The following code example creates a NamedRange and sets a reference in cell C2 to refer to cell C1, and then sets a reference in the NamedRange to refer to cell C2. The code example then uses the DirectPrecedents property to select the direct precedent of the NamedRange, which is cell C2.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange precedentRange;
private void SelectDirectPrecedents()
{
    precedentRange = this.Controls.AddNamedRange(
        this.Range["B1", missing], "precedentRange");

    this.Range["C1", missing].Value2 = 1710;
    this.Range["C2", missing].Value2 = "=C1";

    this.precedentRange.Value2 = "=C2";
    this.precedentRange.DirectPrecedents.Select();
}
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.