End(xlUP) seems to me as a function

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I understand the code below what what I do not really understand is End(xlUp).
I read that it is a Property of Range and it is of type of Range itself. It is used to change the direction of a cell. But what I do not understand, why xlUp passed between 2 () to me that suggest it is a function/method, not property.

Thank you.

Code:
Sub abc()
    Dim x As Double
    x = Cells(Rows.Count, 1).End(xlUp).Row
    MsgBox x
End Sub
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
xlUp is NOT a function. You cannot pass any parameters/values to it.
xlUp is the equivalent to go to any range, and then pressing CTRL+Up Arrow, which goes to the first cell with data in it (when moving in that upward direction).
.Row just pulls the row number off of that range you just found and stopped in.
 
Upvote 0
.End is a property, which is very much like a function.

xlUP is not a function, it is a value.

The .End property can take one of four arguments xlUp, xlDown, xlToRight or xlToLeft, depending on which direction one wants the End to seek its result.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,225,738
Messages
6,186,736
Members
453,369
Latest member
juliewar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top