title: Function arguments VBA
body: <p>I have these three functions:</p>
  
  <p>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.</p>
  
  <p>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?</p>
  
  <pre><code>Public Function Tinn(Tw, Qw, Qp, Q, deltaT)
  
  Tinn = (((Tw * Qw) + (Tut(Q, fd, mix) * Q)) / Qp) + deltaT
  
  End Function
  </code></pre>
  
  <hr>
  
  <pre><code>Public Function Tut(Q, fd, mix)
  
  Tut = Tinn(Tw, Qw, Qp, Q, deltaT) _
      - (avgittEffektAiUiLMTD() / ((Q * fd * mix) / 3600))
  
  End Function
  </code></pre>
  
  <hr>
  
  <pre><code>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
  </code></pre>