Similar case as Q27956847.

Hi EE,

I´m looking for a solution very much the same as the case described in Q27956847. Only difference is that in this case I would like the UDF to get the row number where the maximum value(s) is(are) found. Range of data is on column G. Please refer to sample file Book1.xls attached.

Who is Participating?
ButlerTechnologyConnect With a Mentor Commented:
Sorry -- Remove the msgbox HighestValue line -- I was using that for testing.
Try the below UDF:
Public Function MaxRow(rRange As Range) As Integer
Dim cCell As Variant
Dim Highestvalue As Single
Dim iRow As Integer
    For Each cCell In rRange
    If cCell.Value > Highestvalue Then
        Highestvalue = cCell.Value
        iRow = cCell.Row
        MsgBox Highestvalue
    End If
MaxRow = iRow
End Function

Open in new window

capterdiAuthor Commented:
It works, but before getting to the result, windows with numbers and an OK button keep popping up until you are done with the last one.
capterdiAuthor Commented:
That´s it. Perfect.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.