September 2001
Beginner
528 pages
11h 59m
English
To execute the code in a procedure—in other words, to call the procedure—you use a different syntax for sub- and function procedures. Because a function returns a value, it is an expression, and you call it by referring to it anywhere an expression could be used. Perhaps most commonly, a function is called by referring to it on the right side of an assignment statement. If you have a function named HalfOf, for example, you could call it and assign the return value to X as follows:
x = HalfOf(y)
Or, you could call the function and display the return value in the Immediate window:
Debug.Print HalfOf(104)
Calling sub procedures is different. Because they do not return a value, they cannot be treated as an expression. You ...
Read now
Unlock full access