End Method

Applies To

Range Object.

Description

Returns a Range object that represents the cell at the end of the region that contains the source range. Equivalent to pressing END+UP ARROW, END+DOWN ARROW, END+LEFT ARROW, or END+RIGHT ARROW.

Syntax

object.End(direction)

object

Required. A cell in the range.

direction

Required. Specifies the direction to move. One of xlToLeft, xlToRight, xlUp, or xlDown.

Example

This example selects the cell at the top of column B in the region containing cell B4.


Range("B4").End(xlUp).Select

This example selects the cell at the end of row 4 in the region containing cell B4.


Range("B4").End(xlToRight).Select

This example extends the selection from cell B4 to the last cell in row four that contains data.


Worksheets("Sheet1").Activate
Range("B4", Range("B4").End(xlToRight)).Select