Passing a named range to a function

M

Mike M 91107

I have a named range called "Temperature" that is 1 x 10 vector.

I have a function x(ByVal value1 as double, Byval value2 as double) that I
need to run on all 10 temperatures.

When I go x(4,5) the function works.

When I go x(Temperature,5) the function gives #VALUE! error. My intent is
that the function will pull the Temperature value from the vector in the
column above it (or row beside it).

Little help?
 
R

Rick Rothstein

Hard to know what you are trying to do, and hence it is hard to make
specific recommendations, when you hide the code from us. I can tell you
that your first argument is expecting a simple variable of type Double and
you are attempting to pass a Range (which is not a simple variable) into it.
You might be able to overcome that by using a Variant, then testing the type
of data that was passed in and reacting to that. Again, seeing your code
would make it easier to recommend something. By the way, is the Temperature
range **always** the one you want to do your calculations from... or could
there be other named ranges that the function will need to be able to
process?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top