Sub Procedures versus Function Procedures

Vertex42 The Excel Nexus

Professional Excel Templates

Get Instant Access

You can think of a Sub procedure as a command that can be executed either by the user or by another procedure. Function procedures, on the other hand, usually return a single value (or an array), just like Excel worksheet functions and VBA built-in functions do. Like with built-in functions, your Function procedures can use arguments.

Function procedures are quite versatile and can be used in two situations:

♦ As part of an expression in a VBA procedure

♦ In formulas that you create in a worksheet

In fact, you can use a Function procedure anywhere that you can use an Excel worksheet function or a VBA built-in function.

Was this article helpful?

0 0

Post a comment