One, End (Xlup). Row Introduction
function is to return a Range object that represents the cell at the end of the range that contains the source range. Equivalent to the key end+ up ARROW, end+ down ARROW, end+ left arrow, or end+ right arrow. Range object, read-only.
The syntax is as follows:
Expression. End (Direction)
expression Required. An expression that returns one of the objects in the Applies To list.
Direction xldirection type, required. The direction that you want to move.
XlDirection can be one of the XlDirection constants.
Second, end (Xlup). Row example
This example selects the cell at the top of column B in the range that contains cell B4.
Range ("B4"). End (Xlup). Select
This example selects the cell in the end of line 4th in the range that contains cell B4.
Range ("B4"). End (xlToRight). Select
This example extends the selection from cell B4 to the last cell in line fourth that contains data.
Worksheets ("Sheet1"). Activate
Range ("B4", Range ("B4"). End (xlToRight)). Select
Range ("a65536"). End (Xlup). Row A column number of the last row in the data range
Range ("b65536"). End (Xlup). Row B column number of the last line in the data range
Range ("d65536"). End (Xlup). Row d column data area last line number
Range ("k65536"). End (Xlup). Row k column line number on last line of data range
Finally, take a look at the code that is called by VBA:
Dim I, M, IRow, SH, arr
M = 0.0015
For each sh in thisworkbook.sheets
IRow = sh.[d65535]. End (Xlup). Row
ReDim arr (1 to IRow, 1 to 2)
arr = sh. Range ("D3:e" & IRow)
For i = 2 to UBound (arr)
Arr (i, 1) = arr (i, 1) * M
Arr (i, 2) = Arr (i, 2) * M
Arr (1, 1) = Application.Substitute (arr (1, 1), "square meter", "mu")
Arr (1, 2) = Application.Substitute (arr (1, 2), "square meter", "mu")
Sh. Range ("D3:e" & irow) = arr