Share via


NamedRange.RefersToRange Property (2007 System)

Gets the Range referred to by a NamedRange control.

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property RefersToRange As Range
'Usage
Dim instance As NamedRange 
Dim value As Range 

value = instance.RefersToRange
[BrowsableAttribute(false)]
public Range RefersToRange { get; }
[BrowsableAttribute(false)]
public:
property Range^ RefersToRange {
    Range^ get ();
}
public function get RefersToRange () : Range

Property Value

Type: Range
A Range referred to by a NamedRange control.

Remarks

Use the RefersTo property to change the range that a NamedRange control refers to.

Examples

The following code example starts a series of day names and then creates a NamedRange to contain the series. It then uses the AutoFill method to complete the series. AutoFill requires a Range as a parameter.

This example is for a document-level customization.

Private Sub AutoFillRange()
    Me.Range("A1").Value2 = "Sunday" 
    Me.Range("A2").Value2 = "Monday" 
    Dim dayRange As Microsoft.Office.Tools.Excel.NamedRange = _
        Me.Controls.AddNamedRange(Me.Range("A1", "A7"), _
        "dayRange")
    Me.Range("A1", "A2").AutoFill(dayRange.RefersToRange, _
        Excel.XlAutoFillType.xlFillDays)
End Sub
private void AutoFillRange()
{
    this.Range["A1", missing].Value2 = "Sunday";
    this.Range["A2", missing].Value2 = "Monday";
    Microsoft.Office.Tools.Excel.NamedRange dayRange
        = this.Controls.AddNamedRange(this.Range["A1", "A7"], 
        "dayRange");
    this.Range["A1", "A2"].AutoFill(dayRange.RefersToRange,
        Excel.XlAutoFillType.xlFillDays);
}

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace