Looking for a value in a previous row

  • Thread starter Thread starter ejack
  • Start date Start date
E

ejack

I am trying to determine a previous row number in a chart like this --
..
..
..
xxx xxx data xxx xxx xxx xxx xxx xxx
xxx xxx xxx xxx
 
If I understand you correctly; the data row will always be filled (especially
ColA,ColB,ColC) and for the current row these columns will not be filled.

In that case; the below code should give you the previous data row. Try and
feedback

Dim lngDataRow as Long
lngDataRow = Cells(Activecell.row, "C").End(xlUp).Row

If this post helps click Yes
 
Jacob Skaria said:
If I understand you correctly; the data row will always be filled (especially
ColA,ColB,ColC) and for the current row these columns will not be filled.

In that case; the below code should give you the previous data row. Try and
feedback

Dim lngDataRow as Long
lngDataRow = Cells(Activecell.row, "C").End(xlUp).Row

If this post helps click Yes

Thanks Jacob, yes, you do understand that the subsequent rows will be
indented essentially. That looks like a basic code call. It has been years
since I had to use basic in my spreadsheets. Do you think it is necessary to
use basic?
 
The below formula will give you the next entry upwards in the range C1:C10..
=LOOKUP(2,1/(C1:C10<>""),C1:C10)

So you can apply that in row 11...

If this post helps click Yes
 
OK, thanks Jacob. I tweaked it to =LOOKUP(2,1/(R1C1:RC1<>""),R1C1:RC1) so it
is general to the current row, thanks again.
 
Back
Top