What is the syntax to declare a function?

Function <function name> (<parameter name> As <data type>)
     'parameters are optional
     <your code here>
End Function

Always place functions in Modules folder, otherwise Excel will not find it and you will get a #NAME? error.

Advertisements