G Guest Sep 26, 2007 #1 Would someone please be so kind as to compare and contrast the differences between a sub and a function. Thank you.
Would someone please be so kind as to compare and contrast the differences between a sub and a function. Thank you.
C Chip Pearson Sep 26, 2007 #2 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)
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)