Access Built-in

Visual Basic for Applications has functions either built-in or user-defined (UDFs), automating processes and accessing Windows API and other low-level functionality through dynamic-link libraries (DLLs). It supersedes and expands on the abilities of earlier application-specific macro programming languages such as Word's WordBASIC. It can be used to control many aspects of the host application, including manipulating user interface features, such as menus and toolbars, and working with custom user forms or dialog boxes.

The difference between a function and a sub in VBA is that a function can return a value while a sub (subroutine) cannot. Functions and subs become very useful as program size increases. If you want Excel VBA to perform a task that returns a result, you can use a function. Place a function into a module (In the Visual Basic Editor, click Insert, Module).

Function Examples
Function to calculate Area

ActiveX

 * CreateObject
 * GetObject

Application

 * Command
 * Shell

Arrays

 * Array
 * Filter
 * Join
 * LBound
 * Split
 * UBound

Conversion

 * Asc
 * CBool
 * CByte
 * CCur
 * CDate
 * CDbl
 * CDec
 * Chr
 * CInt
 * CLng
 * CSng
 * CStr
 * CVar
 * Day
 * EuroConvert
 * FormatCurrency
 * FormatDateTime
 * FormatNumber
 * FormatPercent
 * GUIDFromString
 * Hex
 * Nz
 * Oct
 * Str
 * StringFromGUID
 * Type Conversion
 * Val

Database

 * CurrentUser
 * DDEInitiate
 * DDERequest
 * Eval
 * HyperlinkPart
 * Partition

Date/Time

 * Date
 * DateAdd
 * DateDiff
 * DatePart
 * DateSerial
 * DateValue
 * Day
 * Hour
 * Minute
 * Month
 * MonthName
 * Now
 * Second
 * Time
 * Timer
 * TimeSerial
 * TimeValue
 * Weekday
 * WeekdayName
 * Year

Domain aggregate

 * DAvg
 * DCount
 * DFirst
 * DLast
 * DLookup
 * DMax
 * DMin
 * DStDev
 * DStDevP
 * DSum
 * DVar
 * DVarP

Error handling

 * CVErr
 * Error
 * IsError

File input/output

 * EOF
 * FreeFile
 * Input
 * Loc
 * LOF
 * Seek

File management

 * CurDir
 * Dir
 * FileAttr
 * FileDateTime
 * FileLen
 * GetAttr

Financial

 * DDB
 * FV
 * IPmt
 * IRR
 * MIRR
 * NPer
 * NPV
 * Pmt
 * PPmt
 * PV
 * Rate
 * SLN
 * SYD

Inspection

 * Environ
 * GetAllSettings
 * GetSetting
 * IsArray
 * IsDate
 * IsEmpty
 * IsError
 * IsMissing
 * IsNull
 * IsNumeric
 * IsObject
 * TypeName
 * VarType

Math

 * Abs
 * Atn
 * Cos
 * Exp
 * Fix
 * Int
 * Log
 * Rnd
 * Round
 * Sgn
 * Sin
 * Sqr
 * StDev
 * StDevP
 * Tan

Messages

 * InputBox
 * MsgBox

Miscellaneous

 * CallByName
 * IMEStatus
 * QBColor
 * RGB
 * Spc
 * Tab

Program flow

 * Choose
 * DoEvents
 * IIf
 * Switch

SQL aggregate

 * Avg
 * Count
 * Max
 * Min
 * StDev
 * StDevP
 * Sum
 * Var
 * VarP

Text

 * Format
 * HtmlEncode
 * InStr
 * InStrRev
 * LCase
 * Left
 * Len
 * LTrim
 * Mid
 * PlainText
 * Replace
 * Right
 * RTrim
 * Space
 * StrComp
 * StrConv
 * String
 * StrReverse
 * Trim
 * UCase