如何通过传递特定的逗号分隔的单元格地址来获取最大值的单元格地址?
发布于 2015-06-12 13:21:04
考虑以下UDF
Public Function WhereIsMax(sIN As String) As String
Dim mx As Variant, wf As WorksheetFunction
Dim rng As Range, r As Range
Set wf = Application.WorksheetFunction
Set rng = Range(sIN)
mx = wf.Max(rng)
For Each r In rng
If r.Value = mx Then
WhereIsMax = r.Address(0, 0)
Exit Function
End If
Next r
End Function
只需将逗号分隔的列表放在某个单元格中,然后引用它:
注意:
如果您想要将输入列表放在中,则需要对UDF进行一些调整。
https://stackoverflow.com/questions/30803623
复制