title: Passing variable to function and back VBA
body: <p>Trying to understand how to pass a value back from a function to a sub and display the result in a messagebox, but I can't get it. What am I missing Learning code below:-</p>
  
  <pre><code>Sub mySend()
  
  Dim myNum As Integer
  
  myNum = InputBox("Enter number")
  
  myReturn (myNum)
  
  msgbox myReturn 'would like to display result in messagebox here but no joy
  
  End Sub
  '--------------------------------------
  Function myReturn(ByRef myNum As Integer)
  
  Dim myCalc As Integer
  
  myCalc = myNum + 10
  
  myReturn = myCalc
  
  End Function
  </code></pre>