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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find max value from a column

Status
Not open for further replies.

andyukcy

Technical User
Jul 9, 2003
64
0
0
Hello Everyone..

I have a listbox and I want to find the max value from a specific column...

Thanks..
 
Something like this ?
varCol = specific column number (0 based)
With Me![ListBox name]
.SetFocus
varMax = .Column(varCol, 0)
varRow = 0
For i = 1 To .ListCount - 1
If .Column(varCol, i) > varMax Then
varMax = .Column(varCol, i)
varRow = i
End If
Next
.ListIndex = varRow
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top