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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top