Help with code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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),
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top