Function arguments VBA

Posted by user1068249 on Stack Overflow See other posts from Stack Overflow or by user1068249
Published on 2012-07-05T07:39:00Z Indexed on 2012/07/05 9:16 UTC
Read the original article Hit count: 276

Filed under:
|
|
|

I have these three functions:

When I run the first 2 functions, There's no problem, but when I run the last function (LMTD), It says 'Division by zero' yet when I debug some of the arguments have values, some don't. I know what I have to do, but I want to know why I have to do it, because it makes no sense to me.

Tinn-function doesn't have Tut's arguments, so I have to add them to Tinn-function's arguments. Same goes for Tut, that doesn't know all of Tinn's arguments, and LMTD has to have both of Tinn and Tut's arguments. If I do that, it all runs smoothly. Why do I have to do this?

Public Function Tinn(Tw, Qw, Qp, Q, deltaT)

Tinn = (((Tw * Qw) + (Tut(Q, fd, mix) * Q)) / Qp) + deltaT

End Function


Public Function Tut(Q, fd, mix)

Tut = Tinn(Tw, Qw, Qp, Q, deltaT) - (avgittEffektAiUiLMTD() / ((Q * fd * mix) / 3600))

End Function


Public Function LMTD(Tsjo)

LMTD = ((Tinn(Tw, Qw, Qp, Q, deltaT) - Tsjo) - (Tut(Q, fd, mix) - Tsjo)) / (WorksheetFunction.Ln
((Tinn(Tw, Qw, Qp, Q, deltaT) - Tsjo) / (Tut(Q, fd, mix) - Tsjo)))

End Function

© Stack Overflow or respective owner

Related posts about excel

Related posts about function