PDA

View Full Version : [SOLVED] LastRow from a specific Cell



Crikriek
12-05-2016, 09:15 AM
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

Kenneth Hobs
12-05-2016, 09:27 AM
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.

Crikriek
12-05-2016, 09:40 AM
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 ?

Kenneth Hobs
12-05-2016, 09:48 AM
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.

Crikriek
12-05-2016, 10:04 AM
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 ?

Crikriek
12-05-2016, 10:08 AM
Found it ! It's just cells(59, "C").End(xlUp).Row

Thanks a lot !