It is similar to a subroutine in that it returns a value. Excel has many functions for example Sum and the VBA function statement allows you to write your own. An example of a needed function that if I pass a number to the function I want it to return to me the letter representing the column in Excel. Naming What is it? Returning a value Real code example ColumnLetter Passing Parameters You can think of a function as a black box. This means you don't know how it works, but you give it data and you get an answer. An example of a function that adds two numbers is:
to call the function you can do something like z = Sum(7,2)
Lesson |