View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Niek Otten
 
Posts: n/a
Default UDF's using other UDF's

If you insert "Option Explicit" in your module you'll find that you use an
undeclared variable ReWe (twice)
Try and see if correcting just that solves your problem

BTW ToolsOptionsEdit, check "Require variable declaration" inserts the
"Option Explicit" in you modules automatically, which is strongly
recommended.

--
Kind regards,

Niek Otten


"millsy" wrote in
message ...

I know that the first calculation is correct by changing the code so
that I can see its result. One of the inputs I am using is:

Ws = 2300, We=700,Rs=2330, Re=900

If I place a ' in front of all the if statements in the Findcase
function to disable them and change Findcase=0 to Findcase=WsRs I get
the answer 0.5 which I would expect. If I then change Findcase=WsRs to
Findcase=RsWe I get 16.8333 instead of 7.5. If I then put a ' in front
of the line WsRs=Timediff(Ws,Rs) I get the correct answer of 7.5 for
RsWe. The first function call seems to mess up the second and
subsequent ones.

If I use the Timediff function in the spreadsheet I get the correct
answer for RsWe so it is capable of producing the correct answer.

As to the expected output, I would expect Findcase to produce a value
of 1 using the above inputs.


--
millsy
------------------------------------------------------------------------
millsy's Profile:
http://www.excelforum.com/member.php...fo&userid=5122
View this thread: http://www.excelforum.com/showthread...hreadid=494261