Expand Minimize

NamedRange.Dependents Property

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

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

Range Dependents { get; }

Property Value

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

This property can return a multiple selection (a union of Microsoft.Office.Interop.Excel.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 A1 to refer to the NamedRange. It then sets a reference in cell A2 to refer to cell A1. The code example then uses the Dependents property to select the dependents of the NamedRange, which are cells A1 and A2.

This example is for a document-level customization.


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

    this.Range["A2", missing].Value2 = "=A1";
    this.dependentsRange.Dependents.Select();
}


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft