Sub Vs. Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Would someone please be so kind as to compare and contrast the differences
between a sub and a function. Thank you.
 
A Function procedure can return a result to the calling procedure, while a
Sub procedure does not return a result:

Sub AAA()
Dim L As Long
L = MyFunction(2)
MsgBox L
End Sub

Function MyFunction (T As Long)
MyFunction = T * 10
End Function


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
Back
Top