Complete Introduction to Excel End (Xlup). Row

Source: Internet
Author: User

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.

Xldown

xlToRight

xlToLeft

Xlup

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

Another example:

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

Next

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

Next

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.