ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with code (https://www.excelbanter.com/excel-programming/320645-help-code.html)

No Name

Help with code
 
With data in cells A1:A12, in the immediate window, I get:

? Range("A65536").End(xlUp).Row
12
? Cells(Rows.Count,"a").end(xlup).row
12
? Range("A" & Rows.Count).End(xlUp).Row
12
? Range("A:A").End(xlUp).Row
1

Why (in the last case) am I getting 1 ?
Thanks (in advance),



Tom Ogilvy

Help with code
 
If you select column A and do End, then Up Arrow, I get A1.

--
Regards,
Tom Ogilvy

wrote in message
...
With data in cells A1:A12, in the immediate window, I get:

? Range("A65536").End(xlUp).Row
12
? Cells(Rows.Count,"a").end(xlup).row
12
? Range("A" & Rows.Count).End(xlUp).Row
12
? Range("A:A").End(xlUp).Row
1

Why (in the last case) am I getting 1 ?
Thanks (in advance),





gocush[_29_]

Help with code
 
The .End(xlUp) starts "searching" from the uppermost cell of the range object
specified. The range object A:A includes A1 so .End(xlUp) starts with A1 and
goes up from there. Hence it returns row=1

" wrote:

With data in cells A1:A12, in the immediate window, I get:

? Range("A65536").End(xlUp).Row
12
? Cells(Rows.Count,"a").end(xlup).row
12
? Range("A" & Rows.Count).End(xlUp).Row
12
? Range("A:A").End(xlUp).Row
1

Why (in the last case) am I getting 1 ?
Thanks (in advance),





All times are GMT +1. The time now is 11:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com