Working with Range

R

Robin Clay

This doesn't work in my subroutine:-

-----------------------------
Function MyTest(XRange as Range) as double
......
XMin = MIN(XRange)
MyTest=XMin
......
End Function
-----------------------------

It gives an error "ByRef argument type mismatch"

I don't know -
(a) why, and
(b) what to use instead.

Help, please ?


Regards

Robin
 
R

Rick Rothstein

Try it this way...

.....
XMin = WorksheetFunction.Min(XRange)
MyTest=XMin
.....
 
M

Michael

Trying adding this to your function:
XMin=Application.WorksheetFunction.Min(XRange)
 
R

Robin Clay

Thank you !

I had tried that, but as
XMin=WorksheetFunction.Min(XRange)
without the "Application" bit.


Regards

Robin
 
Top