Excel VBA Strings

This post will guide you how to use VBA String functions to manipulate the String in MS excel VBA.

There are many String Functions, which can be used to manipulate the string very effectively in excel as bellows:

Function Name & Description
InStr Returns the position of the first occurrence of the specified substring in a string. Search happens from the left to the right.
InstrRev Returns the position of the first occurrence of the specified substring in a string. Search happens from the right to the left.
Lcase Returns the lower case of the specified string.
Ucase Returns the upper case of the specified string.
Left Returns a substring (a specified number of the characters) from a text string, starting from the leftmost character.
Right Returns a substring (a specified number of the characters) from a text string, starting from the rightmost character.
Mid Returns a substring from a text string at the position that you specify.
Ltrim  

Returns a string after removing the spaces on the left side of the specified string.

Rtrim  

Returns a string after removing the spaces on the right side of the specified string.

Trim  

Returns a string value after removing both the leading and the trailing blank spaces.

Len  

Returns the length of the given string.

Replace Returns a string after replacing a string with another string.
Space Fills a string with the specified number of spaces.
StrComp Returns an integer value after comparing the two specified strings.
String  

Returns a string with a specified character for specified number of times.

StrReverse  

Returns a string after reversing the sequence of the characters of the given string.

Comments

So empty here ... leave a comment!

Leave a Reply

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

Sidebar