End Property

This property returns a Range object that represents the cell at the "end" of the region that contains the source range by mimicking a keystroke combination (see the following code). The syntax is:


where RangeObject should be a reference to a single cell and Direction is one of the following constants. (The keystroke combination is also given in the following code.)

Enum XlDirection xlUp = -4162 ' Ctrl-Up xlToRight = -4161 ' Ctrl-Right xlToLeft = -4159 ' Ctrl-Left xlDown = -4121 ' Ctrl-Down

End Enum

Thus, for instance, the code:

Range("C4").End(xlToRight).Select selects the rightmost cell in Row 4 for which all cells between that cell and cell C4 are nonempty (that is, the cell immediately to the left of the first empty cell in row 4 following cell C4).

0 0

Post a comment