Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max value index from table

Status
Not open for further replies.

remeng

Technical User
Jul 27, 2006
519
US
Hi,

I have the following line of code which returns the max value in a column located within a table. This works just fine. What I'd like to do is also get the table row index for that value. How can I take the value and get the index for the row?

Code:
fred = Application.WorksheetFunction.Max(Range("non_p_plan_length_table[Min Length]"))

thanks,

Mike
 
Range.Find returns cell(s) satysfying search criteria.

combo
 
Mike,

I'm assuming that you have a column heading Index...
Code:
Dim idx as Long
Dim xl As Application
Set xl = Application
fred = xl.Max([non_p_plan_length_table[Min Length]])
idx = xl.Index([non_p_plan_length_table[Index]], xl.Match(Fred, [non_p_plan_length_table[Min Length]],0),1)

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top