[英]How to find get the variable name having largest value in Excel VBA?
Consider a table with Names in 'A' and their Marks in 'B'.考虑一个表,名称在“A”中,它们的标记在“B”中。 I need to find the Name with maximum marks and use this name as a result of another Condition.我需要找到具有最大标记的名称,并将此名称用作另一个条件的结果。
In this Sheet, My Maximum value is "SZ04", I need this as the result of Max function and not the value(6) itself.在这张表中,我的最大值是“SZ04”,我需要这是 Max 函数的结果,而不是 value(6) 本身。
May be something like that可能是这样的
Sub Test()
Dim x
x = Application.Match(Application.Max(Columns(2)), Columns(2), 0)
If Not IsError(x) Then
MsgBox Cells(x, 1).Value
End If
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.