Custom Functions exam 2

Custom Functions exam 2 - Writing Custom Functions in VBA...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Click to edit Master subtitle style Writing Custom Functions in VBA Chapter 14
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Custom VBA Functions ¡ "Custom" because you design it and write it in VBA  for your specific purpose. ¡ Examples: l A function that calculates a sales commission that may  include complex logic l A function that calculates one of the payroll tax deductions  for employees ¡ Also called a " User Defined " Function because it is  created entirely by the user. ¡ Once written in VBA, it can be accessed from the 
Background image of page 2
Parts of the Function Definition ¡ Defining the function means writing it in the programming  language. ¡ The first line is the function " header " l Begin with "Function" keyword l Assign a name to the function l List the names and data types of the inputs inside parentheses.   ¡ Use keyword "As" before data type.   ¡ Separate argument definitions with a comma. ¡ Specify the data type for the function's return value (following the 
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Custom Functions exam 2 - Writing Custom Functions in VBA...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online