Microsoft Office Tutorials and References
In Depth Information
Figure 7-2. An InputBox dialog box
returns the leftmost number characters in string , and:
Right( string , number )
returns the rightmost number characters in string . For instance:
MsgBox Right("Donna Smith", 5)
displays the string Smith .
The syntax for Mid is:
Mid( string , start , length )
This function returns the first length number of characters of string , starting at
character number start . For instance:
Mid("Library.xls",9,3)
returns the string xls . If the length parameter is missing, as in:
Mid("Library.xls",9)
the function will return the rest of the string, starting at start .
The InStr, InStrRev functions
The syntax for the very useful InStr function is:
Instr( Start , StringToSearch , StringToFind )
The return value is the position, beginning at Start , of the first occurrence of
StringToFind within StringToSearch . If Start is missing, then the function starts
searching at the beginning of StringToSearch . For instance:
MsgBox Instr(1, "Donna Smith", "Smith")
displays the number 7 , because "Smith" begins at the seventh position in the string
"Donna Smith."
The InStrRev function is analogous to InStr but searches backwards through the
StringToSearch string.
The Replace function
This very useful function (not available in Excel 97) is used to replace a substring in a
string by another string. For instance, the code:
MsgBox Replace("the car is red", "red", "blue")
displays the string "the car is blue".
The Str and Val functions
Search JabSto ::




Custom Search