title: VBA Writing Function Outcome into active and offset cell
body: <p>I created a function which has two outcomes: t_final and q_final (t means time, q means the rate of production).</p>
  <p>When I use the first coding in VBA without explicitly mention the cell and just have one outcome (t_final), the result appears. But I need two outcomes and write them in a consecutive cell.</p>
  <p>The first code gives me the calculated result. The second one only gives me #value.</p>
  <pre><code> Function t_final(qi, Di, b, q_limit)
  'qi: initial rate
  'Di: initial decline rate
  'b:  decline exponent
  'q_limit : economic limit for rate
  'Nominal decline is the instantaneous decline rate
      Dim i, t, q_final
      i = 1
      Do
      t = i * 30
      q_final = arpsrate(qi, Di, b, t)
      i = i + 1
      t_final = t
      Loop Until q_final &lt; q_limit
  
   End Function
  'The second code is the same as the first one with additional:
  ActiveCell.Offset(0, 1).Value = t_final
  ActiveCell.Offset(0, 2).Value = q_final
  </code></pre>
  <p>Thank you for paying interest to my problem!</p>