我用谷歌搜索了很多,但我想确定:
我真的需要为 max-Function 使用“Application.WorksheetFunction.Max”吗?
如果是,我可以缩短这个吗?如果我将这个长结构变形为一个函数,是否会产生开销?
编辑:我已经删除了 vba-access 标签。
After I see, that my question was unclear, I answer it by myself.
Some people did not know, if I mean EXCEL or ACCESS. My fault, to give the wrong tag. It was meant, as a pure VBA question.
Second mistake: I was providing a EXCEL-Way (Worksheet) for my question. But it was meant, as pure VBA question.
I can not delete the question, but I like to do that.
So the answer is:
Public Function max(x, y As Variant) As Variant
max = IIf(x > y, x, y)
End Function
Public Function min(x, y As Variant) As Variant
min = IIf(x < y, x, y)
End Function
Run Code Online (Sandbox Code Playgroud)
... is doing the job.
Sorry for wasting our time!
| 归档时间: |
|
| 查看次数: |
30270 次 |
| 最近记录: |