Consulting

Results 1 to 6 of 6

Thread: LastRow from a specific Cell

  1. #1
    VBAX Regular
    Joined
    Nov 2016
    Posts
    17
    Location

    LastRow from a specific Cell

    Hi,

    I want to find the last cell used from a particular cell. THe current code I have is

    lastrow = cells(rows.count, "C").End(xlUp).Row

    But what if I want it starts counting the last row used as from cell C35 ? How should the code be ?

    Thank you,

    Kind regards,

    Christophe

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    It is the same, essentially. Of course if C35 and below are empty, then lastrow will be < 35. You can check for that. Of course that just means last cell with a value in Column C.

  3. #3
    VBAX Regular
    Joined
    Nov 2016
    Posts
    17
    Location
    Hi Kenneth,

    Thank you for your answer. Issue here is that the start of my list if at C35 but another list starts at C60. Any way I could count the filled-in cells as from C35 ?

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Is this a ListObject table or just data?

    While the usually approach is to start from the actual last cell in a column, and go up until a value is found, one can start from a cell and go down. That only works if there are not blank entries. If you know your data, that method will suffice in some cases. I would check that it did not return a row in the next "list" though.

    What you may want to do is to start from the first cell in the next "list" and then go up from there. That will take care of the empty cell issue.

  5. #5
    VBAX Regular
    Joined
    Nov 2016
    Posts
    17
    Location
    Ok So I just write lastrow = cells(rows.count, "C59").End(xlUp).Row and it should go get the last active cell starting from C35 ?

  6. #6
    VBAX Regular
    Joined
    Nov 2016
    Posts
    17
    Location
    Found it ! It's just cells(59, "C").End(xlUp).Row

    Thanks a lot !

Posting Permissions

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