+ Reply to Thread
Results 1 to 3 of 3

Help with code

  1. #1
    Guest

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



  2. #2
    Tom Ogilvy
    Guest

    Re: Help with code

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

    --
    Regards,
    Tom Ogilvy

    <anonymous@discussions.microsoft.com> wrote in message
    news:00d001c4f8d6$6bf64d10$a301280a@phx.gbl...
    > 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),
    >
    >




  3. #3
    gocush
    Guest

    RE: 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

    "anonymous@discussions.microsoft.com" 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),
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1