Adding function arguments
In VBA terms, when referring to an argument within a function, we refer to information that needs to be passed to the function in order to present us with a sensible answer.
The functions we have written so far haven't had any arguments, meaning that there was no need to pass any information to it. It simply presented us with the result of a built-in VBA function.
Although VBA will let you add as many as 60 arguments to a function, we hardly ever use more than three or four. In many cases, we get along fine with a single argument.
In this recipe, we will be adding function arguments to a custom function.
Getting ready
Make sure that CustomFuntions.xlsm
is still open. Activate Sheet1, and enter the following data:
Once done, switch to the VBA Editor.
How to do it…
Follow these steps to add a function argument:
- We need a function that can tell us which students...