How to Call Functions in VBA?

A function is a group of reusable code that can be called anywhere in your program. This eliminates the need of writing the same code over and over again. This enables the programmers to divide a big program into a number of small and manageable functions.

  1. Choose Developer → Code → Macros.
  2. Type the word CubeRoot in the Macro Name box.
  3. Click the Options button.
  4. Enter a description of the function in the Description box.
  5. Click OK to close the Macro Options dialog box.
  6. Close the Macro dialog box by clicking the Cancel button.