ExcelVBA: Find max Value in filtered range
Posted on 2010-11-07
What VBA would I need so that it will find a maximum value from a filtered worksheet.
(See Example Below...)
Pretend I have a worksheet with data that looks like below... (Autofilters turned on)
Column A B
Row1: Names Age
Row2: John 20
Row3: Mat 24
Row4: John 28
Row5: Matt 15
Row6: John 22
Pretend the user autofilters Colum A("Names") to only show rows with "John".
(Only 3 rows will show in this case because there are 3 rows with "John" in Column A.)
When a user presses a button on this worksheet a message will display saying the following:
"The oldest person in the filtered range is 28"
Please submit the fastest code to accomplish this task. (i.e. if the user had 40,000 rows, it could do this task quickly)