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 |
Other Useful Resources:
Click on the following links of the useful resources. These helps to learn and gain more knowledge.
VBA Tutorial VBA Functions List VBA Arrays in Excel Blog
VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers
My spouse and I absolutely love your blog and find the majority of your post’s to be exactly I’m looking for. Does one offer guest writers to write content to suit your needs? I wouldn’t mind writing a post or elaborating on a number of the subjects you write with regards to here. Again, awesome site!
Thanks for your valuable feedback!