Export (0) Print
Expand All
Expand Minimize

NamedRange.DirectDependents Property

Gets a Microsoft.Office.Interop.Excel.Range that represents the range containing all the direct dependents of the NamedRange control.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public Range DirectDependents { get; }

Property Value

A Microsoft.Office.Interop.Excel.Range that represents the range containing all the direct dependents of the NamedRange control.

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 C1 to refer to the NamedRange. It then sets a reference in cell C2 to refer to cell C1. The code example then uses the DirectDependents property to select the direct dependent of the NamedRange, which is cell C1.

Microsoft.Office.Tools.Excel.NamedRange directDependentsRange;
private void SelectDirectDependents()
{
    directDependentsRange = this.Controls.AddNamedRange(
        this.Range["B1", missing], "createMonthRange");
    this.directDependentsRange.Value2 = "Smith";
    this.Range["C1", missing].Value2 = "=" +
        this.directDependentsRange.Address[false, true,
        Excel.XlReferenceStyle.xlA1, false, missing];

    this.Range["C2", missing].Value2 = "=C1";
    this.directDependentsRange.DirectDependents.Select();
}

Show:
© 2014 Microsoft