I have a range in a formula and it works:
=MAX(LN(A2:A7))
Now I want to rebuild this formula as a custom function and it does not work.
Function testy(xr As Range)
n = WorksheetFunction.Max(WorksheetFunction.Ln(xr))
testy = n
End Function
It throws an error: wrong datatype. But I defined "As Range"? Why does it not work, how can I correct it?

