For the use of Xldown and Xlup (Excel VBA)

Xldown and xlup a combination, used to find a non-empty cells in the section.
First, we fill the data before the following row 7 cells:
A1 cells:
A2 cells: 2
A3 cells:. 3
A4 cells:. 4
A5 cells:
A6 cells:. 6
the A7 Cells: 7
the A8 Cell :
the A9 cells:
AlO cells:
A1, A5, the A8, the A9, AlO blank.
A Code:
Worksheets ( "Sheet1") the Range ( "A1") the Select..
Selection.End (xlDown) .Select
- finally selected cell A2 is
the code two:
. Worksheets ( "Sheet1") the Range ( "A2 ") .Select
Selection.End (xlDown) .Select
- final cell is selected A4
Code three:
Worksheets (" Sheet1 AlO ") the select") the Range (.. "
Selection.End (xlUp) .Select
- eventually selected cell A7 is
through these three examples, we can better understand xlDown and xlUp usage.
xlDown: looking down from the selected cell if the selected cell is empty, all the way down the first non-empty cell; if the selected cell is non-empty, then the last went down non-empty cells.
xlUp: only need to xlDown rules upside down, is xlUp rules

Guess you like

Origin blog.csdn.net/sinolover/article/details/95204652