I am a supporter of
St. Joseph's hospice.
 If you find this site useful or if it helped you, consider a small donation to
St. Joseph's, please.

Information on
St. Joseph's

JustGiving - Sponsor me now!


VBA 03 Sub, Function, Params

- Function: encapsulate reasonable portion of functionality,
                   have zero or more parameters,
                   return a return value (parameter),
                   cannot change worksheet contents!

Example: If you have a list of names in column A and corresponding values in column B and you want to show the average of the last 3, 6, or 9 values of some (or all) names - if there are at least 3, 6, or 9 such names, you can solve this
a) with a user-defined function
b) via worksheet functions
See here:

- Sub: Performs "well" defined action(s),
  good for repetitive tasks

- Parameters:
  Optional (Preset)

- Keep similar group of functions and subroutines in same module

- Sort them alphabetically

[Note: Class modules are not part of this intro. If you are interested in this advanced but rewarding stuff please have a look at EverAge's Logger or at my friend Jon T.'s SystemState class]

[Previous]  [Next]

Sulprobil   Get it done   Contact   Disclaimer   Impressum   Download