Sub and Function observable similarity
- The first line is Sub or "Function", the name for the code, and (optionally) some parameters
- The new programmer is taught to declare data at the beginning
- The same building blocks for the internal code are the same: If Then Else, Do and For loops, This = That, etc.
- Subs' and Functions' code can include Function calls as well as execute Subs
Subs and Functions observable dissimilarity
- A Function can be declared with an "As ..." phrase. A Sub cannot.
- When recording a Macro through Excel, the result is a Sub. It is always a Sub, it is never a Function.
- Once written, a Function can be used in a worksheet but a Sub cannot.
Subs and Functions: Different Purposes
Metaphorically, consider a hot summer day when a cold drink would be tasty. Do you want someone to bring you iced tea or make iced tea for you? The former is more like a Function, the latter like a Sub.