VBA Text and String Function

VBA Text and String Functions

VBA Text and String Functions:

VBA Text and String Functions help us to search and manipulate data. These are Asc, Chr, Format, InStr, InStrRev, LCase, Left, Len, LTrim, Mid, Replace, Right, RTrim, Space, Split, Str, String, StrComp, StrConv, StrReverse, Trim, UCase, etc. These functions are Built-In functions. We can use these VBA Text and String functions in either procedure or function. These functions we use in the VBA editor window in Excel. These Text and String functions you can use any number of times in VBA macro codes.

List of Text and String Functions in Excel VBA:

Here are the list of Text and String functions. And also find its description, syntax and return type. We can use these multiple Text and String functions in one statement.

Function Description Syntax Return Type
VBA Asc VBA ASC function returns the ASCII value of the first character from a string. Asc(String) Integer
VBA Chr VBA Chr function returns a character of the ASCII value. Chr(CharCode) String
VBA Format VBA Format function returns a formatted string from a string expression. Format(Expression, [Format], [FirstDayOfWeek],[FirstWeekOfYear]) String
VBA InStr VBA InStr function returns the position of a substring within a string. InStr([start], string, substring, [compare]) Long
VBA InStrRev VBA InStrRev function returns the position of a substring within a string, searching from right to left. InStrRev(StringCheck, StringMatch, [Start], [Compare]) Long
VBA LCase VBA LCase function converts a string to lowercase text. LCase(String) String
VBA Left VBA Left function returns the specified number of characters from a given string, starting from the left most character. Left(string, [length]) String
VBA Len VBA Len function returns the length of a given string. Len(Expression) Integer
VBA LTrim VBA LTrim function removes leading spaces from a given string. LTrim(String) String
VBA Mid VBA Mid function returns a specified number of characters from a specified string. Mid(String, Start, [Length]) String
VBA Replace VBA Replace function replaces a substring with another string in a given string. Replace(Expression, Find, Replace, [Start], [Count], [Compare]) String
VBA Right VBA Right function returns the specified number of characters from a given string, starting from the right most character. Right(string, [length]) String
VBA RTrim VBA RTrim function removes trailing spaces from a given string. RTrim(String) String
VBA Space VBA Space function returns a string with a specified number of spaces. Space(Number) String
VBA Split VBA Split function returns an array of substrings based on a delimiter. Split(Expression, [Delimiter], [Limit], [Compare]) String
VBA Str VBA Str function returns a string which represents a number. Str(Number) String
VBA String VBA String function returns a string which consists of repeated characters. String(Number, Character) String
VBA StrComp VBA StrComp function returns an integer value representing the result of string comparision. StrComp(String1, String2, [Compare]) Integer
VBA StrConv VBA StrConv function converts a string to a specified format(vbUpperCase, vbLowerCase, vbUnicode, vbWide, vbNarrow, vbProperCase, etc.) StrConv(String, Conversion, [LocaleID]) String
VBA StrReverse VBA StrReverse function reverses a given string. StrReverse(Expression) String
VBA Trim VBA Trim function removes leading and trailing spaces from a given string. Trim(String) String
VBA UCase VBA UCase function converts a string to uppercase text. UCase(String) String

List of VBA Functions:

Please click on below link to go back to see all List of VBA Functions.

Quick View of VBA Text and String Functions List of VBA Functions

Leave a Comment

Your email address will not be published. Required fields are marked *