Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find row number of maximum value

Hello,

my task is as follows:

Look for the maximum of the average grades and display it in a message
box by the MsgBox function.

Now that I found the max. value with

Set myRange = Range("E2", ActiveCell)
max = Application.WorksheetFunction.max(myRange)


how do I get the respective row number?

Any help will be appreciated.

Thanks in advance


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Find row number of maximum value

Try something like the following:

Dim DataRng As Range
Dim MaxVal As Variant
Dim MaxRow As Long
Set DataRng = Range("A2:A10")
With Application.WorksheetFunction
MaxVal = .Max(DataRng)
MaxRow = DataRng.Row + .Match(MaxVal, DataRng, 0) - 1
MsgBox MaxRow
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"CGeorges " wrote in
message ...
Hello,

my task is as follows:

Look for the maximum of the average grades and display it in a

message
box by the MsgBox function.

Now that I found the max. value with

Set myRange = Range("E2", ActiveCell)
max = Application.WorksheetFunction.max(myRange)


how do I get the respective row number?

Any help will be appreciated.

Thanks in advance


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find maximum row count of data Steve Excel Discussion (Misc queries) 4 August 20th 08 01:06 PM
function to find the row number of the maximum value in a coll josht Excel Worksheet Functions 0 January 23rd 07 06:25 PM
Find Maximum date sgl Excel Worksheet Functions 3 February 15th 06 08:02 AM
find maximum Frank Drost Excel Discussion (Misc queries) 7 January 18th 06 02:23 AM
find which column has the maximum value Frank Drost Excel Discussion (Misc queries) 2 December 15th 05 01:09 AM


All times are GMT +1. The time now is 03:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"