To follow up on Marcelo's question... show us actual values that could be in the cells (do not simplify things by using 1, 2, 3, etc. for you numbers unless those are your real numbers).Could you show some examples along with expected results?
Give this formula a try (you will probably have to format the cell you put it in as a Date)...Thanks, I have this kind of data in the column "A"
[TABLE="class: grid, width: 83"]
<tbody>[TR]
[TD="width: 83, align: right"]1,43[/TD]
[/TR]
[TR]
[TD="align: right"]50,14
[/TD]
[/TR]
[TR]
[TD]Vendido
[/TD]
[/TR]
[TR]
[TD]Suportes
[/TD]
[/TR]
[TR]
[TD]Resistências[/TD]
[/TR]
[TR]
[TD]Último Preço[/TD]
[/TR]
[TR]
[TD]Papel
[/TD]
[/TR]
[TR]
[TD="align: right"]13/09/2017
[/TD]
[/TR]
[TR]
[TD]MACD[/TD]
[/TR]
</tbody>[/TABLE]
So I need to retrieve this date "13/09/2017", or get the address where it is.
The date is not always the same, nor always in the same cell address in the 1500 rows sheet.
Function FindDate(r As Range)
Dim rFound As Range
Application.FindFormat.NumberFormat = "m/d/yyyy"
Set rFound = r.Find(What:="*", SearchFormat:=True)
If Not rFound Is Nothing Then
FindDate = rFound.Row
Else
FindDate = "Not Found"
End If
End Function
Silly me ... a much simpler formula is available (you will still have to format the cell you put it in as a Date).Give this formula a try (you will probably have to format the cell you put it in as a Date)...
=LOOKUP(9E+99,A:A)
Another way to write a UDF to return the row number...Or maybe this UDF (user Defined Function)
Code:Function FindDate(r As Range) Dim rFound As Range Application.FindFormat.NumberFormat = "m/d/yyyy" Set rFound = r.Find(What:="*", SearchFormat:=True) If Not rFound Is Nothing Then FindDate = rFound.Row Else FindDate = "Not Found" End If End Function
Function FindDate(R As Range) As Long
FindDate = Application.Match(Application.Max(R), R, 0)
End Function
Silly me ... a much simpler formula is available (you will still have to format the cell you put it in as a Date).
=MAX(A1:A15)