This section shows the list of available VBA built-in functions organized by category. VBA functions are used directly in the code in order to perform different actions, i.e. calculations, conversions, etc. Many of the VBA functions have an equivalent Excel built-in or worksheet function. We have covered the VBA WorksheetFunction object and its applicability in this other page.
String/Text Functions
Applies a format to an expression and returns the result as a string. |
|
Returns the position of a substring within a string. |
|
Returns the position of a substring within a string, searching from right to left. |
|
Returns a substring from the start of a supplied string. |
|
Returns the length of a supplied string. |
|
Converts a supplied string to lower case text. |
|
Removes leading spaces from a supplied string. |
|
Returns a substring from the middle of a supplied string. |
|
Replaces a substring within a supplied text string. |
|
Returns a substring from the end of a supplied string. |
|
Removes trailing spaces from a supplied string. |
|
Creates a string consisting of a specified number of spaces. |
|
Compares two strings and returns an integer representing the result of the comparison. |
|
Converts a string into a specified format. |
|
Creates a string consisting of a number of repeated characters. |
|
Reverses a supplied string. |
|
Removes leading and trailing spaces from a supplied string. |
|
Converts a supplied string to upper case text. |
Array Functions
Creates an array, containing a supplied set of values. |
|
Returns a subset of a supplied string array, based on supplied criteria. |
|
Joins a number of substrings contained in an array into a single string. |
|
Returns the lowest subscript for a dimension of an array. |
|
Splits a Text String into a Number of Substrings. |
|
Returns the highest subscript for a dimension of an array. |
Date/Time Functions
Returns the current date. |
|
Adds a time interval to a date and/or time. |
|
Returns the number of intervals between two dates and/or times. |
|
Returns a part (day, month, year, etc.) of a supplied date/time. |
|
Returns a Date from a supplied year, month and day number. |
|
Returns a Date from a String representation of a date/time. |
|
Returns the day number (from 1 to 31) of a supplied date. |
|
Returns the hour component of a supplied time. |
|
Returns the minute component of a supplied time. |
|
Returns the month number (from 1 to 12) of a supplied date. |
|
Returns the month name for a supplied month number (from 1 to 12). |
|
Returns the current date and time. |
|
Returns the second component of a supplied time. |
|
Returns the current time. |
|
Returns the number of seconds that have elapsed since midnight. |
|
Returns a Time from a supplied hour, minute and second. |
|
Returns a Time from a String representation of a date/time. |
|
Returns an integer (from 1 to 7), representing the weekday of a supplied date. |
|
Returns the weekday name for a supplied integer (from 1 to 7). |
|
Returns the year of a supplied date. |
Conversion Functions
Returns an integer representing the code for a supplied character. |
|
Converts an expression to a Boolean data type. |
|
Converts an expression to a Byte data type. |
|
Converts an expression to a Currency data type. |
|
Converts an expression to a Date data type. |
|
Converts an expression to a Double data type. |
|
Converts an expression to a Decimal data type. |
|
Returns the character corresponding to a supplied character code. |
|
Converts an expression to an Integer data type. |
|
Converts an expression to a Long data type. |
|
Converts an expression to a Single data type. |
|
Converts an expression to a String data type. |
|
Converts an expression to a Variant data type. |
|
Applies a currency format to an expression and returns the result as a string. |
|
Applies a date/time format to an expression and returns the result as a string. |
|
Applies a number format to an expression and returns the result as a string. |
|
Applies a percentage format to an expression and returns the result as a string. |
|
Converts a numeric value to hexadecimal notation and returns the result as a string. |
|
Converts a numeric value to octal notation and returns the result as a string. |
|
Converts a numeric value to a string. |
|
Converts a string to a numeric value. |
Information Functions
Tests if a supplied variable is an array. |
|
Tests if a supplied expression is a date. |
|
Tests if a supplied variant is Empty. |
|
Tests if a supplied expression represents an error. |
|
Tests if an optional argument to a procedure is missing. |
|
Tests if a supplied expression is Null. |
|
Tests if a supplied expression is numeric. |
|
Tests if a supplied variable represents an object variable. |
Math/Trig Functions
Returns the absolute value of a number. |
|
Calculates the arctangent of a supplied number. |
|
Calculates the cosine of a supplied angle. |
|
Calculates the value of ex for a supplied value of x. |
|
Truncates a number to an integer (rounding negative numbers towards zero). |
|
Returns the integer portion of a number (rounding negative numbers away from zero). |
|
Calculates the natural logarithm of a supplied number. |
|
Generates a random number between 0 and 1. |
|
Rounds a number to a specified number of decimal places. |
|
Returns an integer representing the arithmetic sign of a number. |
|
Calculates the sine of a supplied angle. |
|
Calculates the tangent of a supplied angle. |
|
Returns the square root of a number. |
Financial Functions
Calculates the depreciation of an asset during a specified period, using the Double Declining Balance Method. |
|
Calculates the future value of a loan or investment. |
|
Calculates the interest part of a payment, during a specific period, for a loan or investment. |
|
Calculates the internal rate of return for a series of periodic cash flows. |
|
Calculates the modified internal rate of return for a series of periodic cash flows. |
|
Calculates the number of periods for a loan or investment. |
|
Calculates the net present value of an investment. |
|
Calculates the constant periodic payments for a loan or investment. |
|
Calculates the principal part of a payment, during a specific period, for a loan or investment. |
|
Calculates the present value of a loan or investment. |
|
Calculates the interest rate per period for a loan or investment. |
|
Calculates the straight line depreciation of an asset for a single period. |
|
Calculates the sum-of-years' digits depreciation for a specified period in the lifetime of an asset. |
File Management Functions
Returns the current path, as a string. |
|
Returns the first file or directory name that matches a specified pattern and attributes. |
|
Returns the mode of a file that has been opened using the Open statement. |
|
Returns the last modified date and time of a supplied file, directory or folder. |
|
Returns the length of a supplied file, directory or folder. |
|
Returns an integer, representing the attributes of a supplied file, directory or folder. |
Other Functions
Selects a value from a list of arguments. |
|
Produces an Error data type for a supplied error code. |
|
Returns the error message corresponding to a supplied error code. |
|
Evaluates an expression and returns one of two values, depending on whether the expression evaluates to True or False. |
|
Displays a dialog box prompting the user for input. |
|
Displays a modal message box. |
|
Evaluates a list of Boolean expressions and returns a value associated with the first true expression. |
No comments:
Post a Comment