Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Working with Range

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Working with Range

Try it this way...

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

--
Rick (MVP - Excel)


"Robin Clay" <Robin_B DOT Clay AT virgin DOT net wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Working with Range

Trying adding this to your function:
XMin=Application.WorksheetFunction.Min(XRange)
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Robin Clay" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Working with Range

Thank you !

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


Regards

Robin


"Michael" wrote:

Trying adding this to your function:
XMin=Application.WorksheetFunction.Min(XRange)
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Robin Clay" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Countif Range not working tommcbrny Excel Worksheet Functions 4 August 1st 08 05:29 PM
Working with a range Dan Chupinsky Excel Discussion (Misc queries) 3 July 6th 05 06:39 AM
working with a named range Gixxer_J_97[_2_] Excel Programming 2 June 1st 05 07:44 PM
Working with range François Excel Programming 6 April 28th 05 01:37 PM
range value with variable not working? James[_24_] Excel Programming 5 October 4th 04 02:43 PM


All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"