Consulting

Results 1 to 7 of 7

Thread: Solved: finding last row w/ (xldown)

  1. #1

    Solved: finding last row w/ (xldown)

    I use .end(xlup) all the time.
    This time I wanted to use (xldown).

    The last row of data is in row 8.

    This line tells me that the last row is 65,536, not 8. Is this correct? What property should I use to find row 8 going down?
    [VBA]
    lrow = Cells(Rows.Count, 1).End(xlDown).Row
    [/VBA]
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  2. #2
    VBAX Regular Gert Jan's Avatar
    Joined
    Oct 2006
    Location
    Houten
    Posts
    62
    Location
    When using Rows.count you start at the bottom, going down leaves you at the bottom, so lrow is always 65536.

    You could try
    [VBA]lrow = Cells(1, 1).End(xlDown).Row [/VBA]

  3. #3
    Thanks Gert,
    works fine.
    But let me clarfy your point.
    You are saying count starts at the bottom of the sheet, not at the top?
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  4. #4
    VBAX Regular Gert Jan's Avatar
    Joined
    Oct 2006
    Location
    Houten
    Posts
    62
    Location
    Try this one out

    [VBA]Sub test()
    Dim lrow As Long
    lrow = Cells(Rows.Count, 1).Row
    MsgBox lrow
    End Sub[/VBA]

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    NO, he is saying that if you set the start row to Rows.Count, then it will start at the bottom of the sheet.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Regular Gert Jan's Avatar
    Joined
    Oct 2006
    Location
    Houten
    Posts
    62
    Location
    Quote Originally Posted by xld
    NO, he is saying that if you set the start row to Rows.Count, then it will start at the bottom of the sheet.
    Thanks for explaining, i should have been a bit more complete in my reply.

    Gert Jan

  7. #7
    Subtle differences.... spices of life....

    thanks Gert and Bob
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

Posting Permissions

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