Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets or sets the formula that the NamedRange control is defined to refer to, using R1C1-style notation in the language of the user.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
Property RefersToR1C1Local As String
Get
Set
string RefersToR1C1Local { get; set; }
Property Value
Type: System.String
The formula that the NamedRange control is defined to refer to. The formula uses R1C1-style notation in the language of the user, and begins with an equal sign.
Remarks
Use the RefersToR1C1Local property to change the range that a NamedRange control refers to.
Examples
The following code example creates a NamedRange and displays the formula for the NamedRange in the language of the user. It then assigns a new cell to the NamedRange and displays the new formula.
This example is for a document-level customization.
Private refersToR1C1LocalRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub DisplayFormulaR1C1Local()
refersToR1C1LocalRange = Me.Controls.AddNamedRange( _
Me.Range("C1", "D2"), "refersToR1C1LocalRange")
MessageBox.Show(refersToR1C1LocalRange.RefersTo)
refersToR1C1LocalRange.RefersTo = "=Sheet1!$C$3"
refersToR1C1LocalRange.Select()
MessageBox.Show(refersToR1C1LocalRange.RefersTo)
End Sub
Microsoft.Office.Tools.Excel.NamedRange refersToR1C1LocalRange;
private void DisplayFormulaR1C1Local()
{
refersToR1C1LocalRange = this.Controls.AddNamedRange(
this.Range["C1", "D2"], "refersToR1C1LocalRange");
MessageBox.Show(refersToR1C1LocalRange.RefersTo);
refersToR1C1LocalRange.RefersTo = "=Sheet1!$C$3";
refersToR1C1LocalRange.Select();
MessageBox.Show(refersToR1C1LocalRange.RefersTo);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.