NamedRange.Previous Property (2007 System)
Gets a Range that represents the previous cell.
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 Previous As Range
'Usage
Dim instance As NamedRange
Dim value As Range
value = instance.Previous
[BrowsableAttribute(false)]
public Range Previous { get; }
[BrowsableAttribute(false)]
public:
property Range^ Previous {
Range^ get ();
}
public function get Previous () : Range
Property Value
Type: Range
A Range that represents the previous cell.
Remarks
This property emulates pressing SHIFT+TAB; unlike the key combination, however, the property returns the previous cell without selecting it.
On a protected sheet, this property returns the previous unlocked cell. On an unprotected sheet, this property always returns the cell immediately to the left of the specified cell.
Examples
The following code example creates a NamedRange and then uses the Previous property to select the cell to the left of the NamedRange.
This example is for a document-level customization.
Private previousRange As Microsoft.Office.Tools.Excel.NamedRange
Private Sub SelectPrevious()
previousRange = Me.Controls.AddNamedRange( _
Me.Range("C1"), "prefixRange")
Me.previousRange.Previous.Select()
End Sub
Microsoft.Office.Tools.Excel.NamedRange previousRange;
private void SelectPrevious()
{
previousRange = this.Controls.AddNamedRange(
this.Range["C1", missing], "prefixRange");
this.previousRange.Previous.Select();
}
.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.