I googled a lot, but I want to be sure:
Do I really need to use "Application.WorksheetFunction.Max" for the max-Function?
If yes, can I shorten this? Is there an overhead if I warp this long construct into a function?
Edit: I have removed the vba-access tag.
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
... is doing the job.
Sorry for wasting our time!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With