Return a row with the Min or Max funtion

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to return the column where the min or max exists rather than
returning the min or max? I am using WorksheetFunction.Min. Thank you very
much.
 
=MATCH(MAX(1:1),1:1,0)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Assume rng is a reference to a single row

Sub FindMinColumn()
Dim rng As Range, rng1 As Range, ans As Variant
Set rng = Rows(3).Cells
ans = Application.Match(Application.Min(rng), rng, 0)
If Not IsError(res) Then
Set rng1 = rng(1, ans)
MsgBox rng1.Column
Else
MsgBox "Problems"
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top