Funções VBA
Funções VBA
For complete details on a particular function, type the function name into a
VBA module, move the cursor anywhere in the text, and press F1.
TEAM LinG
130 Part III: Programming Concepts
TEAM LinG
Chapter 9: Using VBA and Worksheet Functions 131
Function What It Does
Left Returns a specified number of characters from the left of
a string
Len Returns the number of characters in a string
Log Returns the natural logarithm of a number to base e
LTrim Returns a copy of a string, with any leading spaces
removed
Mid Returns a specified number of characters from a string
Minute Returns the minutes portion of a time value
Month Returns the month from a date value
MsgBox Displays a message box and (optionally) returns a value
Now Returns the current system date and time
RGB Returns a numeric RGB value representing a color
Replace Replaces a substring in a string with another substring
Right Returns a specified number of characters from the right of
a string
Rnd Returns a random number between 0 and 1
RTrim Returns a copy of a string, with any trailing spaces
removed
Second Returns the seconds portion of a time value
Sgn Returns an integer that indicates a number’s sign
Shell Runs an executable program
Sin Returns a number’s sine
Space Returns a string with a specified number of spaces
Split Splits a string into parts, using a delimiting character
Sqr Returns a number’s square root
Str Returns a string representation of a number
StrComp Returns a value indicating the result of a string
comparison
String Returns a repeating character or string
(continued)
TEAM LinG
132 Part III: Programming Concepts
Total = Application.WorksheetFunction.Sum(Range(“A1:A12”))
TEAM LinG