Is there a diff between using currentRegion() or End(xlUp)

deadseasquirrels

Board Regular
Joined
Dec 30, 2004
Messages
232
I see most people use
Code:
Cells(65536, 1).End(xlUp)
to find the last row, I am using
Code:
Range("A1").CurrentRegion.Rows.Count
instead, and I was wondering if there was any detriment to how I am doing it. Meaning are there some quirks about how Microsoft determines what the "current region" is that may effect what I expect.

For myself, and I am guessing for most people, I usually have a top row of headings and every other row is filled with information (maybe the information starts on row 2, maybe row 3, but that's not a big deal). What do others think?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

kkknie

Well-known Member
Joined
Apr 29, 2002
Messages
677
If you've got an entire blank row, the .count will only count to the last row before that row. The End(xlUp) will find the last entry in the row regardless of what's above it.

As an example, put a 1 in cells A1, A2 and A3 and then a 1 in cell A5. The A1.Rows.Count will give a 3, but the End(xlup) will give 5.

If you know you will always have data in at least one column of a row, the rows.count will work the same as the end(xlup). I personally always use the end(xlup).

K
 

Forum statistics

Threads
1,148,050
Messages
5,744,513
Members
423,881
Latest member
Nguyen Vu

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
Top