title: Store into variable result of function VBA
body: <p>I have a function that makes a particular calculation. Then, I have a subroutine from which I want to call the function and make some stuff with it. I believe I should be returning a value ("counter") at the end of the function and then storing it on the sub, but how do I do that?</p>
  
  <pre><code>Function thisFunction(int1 As Integer, int2 As Integer)
  
      Dim counter As Integer
      counter = 0
  
      Dim i As Integer
      For i = 1 To 10
          counter = int1 + int2
      Next
  
  End Function
  
  Sub getResult()
  
      Dim result As Integer
      result = thisFunction(5, 2)
      MsgBox (result)
  
  End Sub
  </code></pre>