Thursday, September 4, 2014

Arguments v. Parameters

This was something I learned ages ago and have re-learned recently

An parameter is the designed and defined "bucket" used by a procedure (e.g. a VBA Function or Sub) to carry in what is needed and carry out what is produced.

For example, the Address worksheet function has 5 parameters.  

ADDRESS(row_num, column_num, [abs_num], [a1], [sheet_text])

An argument is what is passed to the Macro, Function, or Sub through the parameter.  For example, entering "=ADDRESS(row_num, column_num, [abs_num], [a1], [sheet_text]) " into a worksheet cell is providing the argument of "2" for the first parameter, row_num.

For a Function, what is returned is the result.  Results can also be passed from a Function or Sub back to the calling procedure through ByRef parameters.

No comments:

Post a Comment