An exercise in passing a value

  • Thread starter Thread starter waterman
  • Start date Start date
W

waterman

I'd like to create a public calculation that would pass
the results back to the procedure that requested it.
However, I can't quite seem to figure it out. What am I
missing?

Private Sub simplerequest()
dothemath 2, 3
MsgBox varAnswer
End Sub

Public Sub dothemath(X, Y)
Dim varAnswer
varAnswer = X + Y
End Sub

Thanks in advance for your help!
 
Never Mind! Answered it myself!

Public Sub simplemath()
MsgBox dothemath(2, 3)
End Sub

Public Function dothemath(X, Y)
dothemath = X * Y
End Function
 
Back
Top