View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Function Vs. Sub

Mars,

The only difference between a Function procedure and a Sub procedure is that
function procedure can return to its caller a value as the result. For
example,

Result = SomeFunction (X, Y, Z)

A Sub procedure cannot return a result. Beyond that, functions and subs are
interchangeable. Neither has a speed or memory advantage over the other.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"mars" wrote in message
...
Hello,

As a novice, I would like to know if someone can tell me
what the guidelines/best programming practices are on when
one should use a "Function" versus a "Subroutine".

It appears to me that both structures are completely
interchangeable. Is there any speed, memory overhead, or
other performance issues?

Perhaps someone can offer a short discussion, or point me
to web site? Thanks for the help in advance.