Megosztás a következőn keresztül:


NamedRange.Precedents Property (2007 System)

Gets a Range that represents all the 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)

Syntax

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

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

Property Value

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

Remarks

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

Examples

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.

Private precedentsRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub SelectPrecedents()
    precedentsRange = Me.Controls.AddNamedRange( _
        Me.Range("C1"), "precedentsRange")

    Me.Range("A1").Value2 = "1710" 
    Me.Range("A2").Value2 = "=A1" 

    Me.precedentsRange.Value2 = "=A2" 
    Me.precedentsRange.Precedents.Select()
End Sub
Microsoft.Office.Tools.Excel.NamedRange precedentsRange;
private void SelectPrecedents()
{
    precedentsRange = this.Controls.AddNamedRange(
         this.Range["C1", missing], "precedentsRange");

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

    this.precedentsRange.Value2 = "=A2";
    this.precedentsRange.Precedents.Select();
}

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace