Returns the position of an occurrence of one string within another, from the end of the string.
InstrRev(stringcheck, stringmatch, [ start, [ compare ]])
The InstrRev function syntax has these named arguments:
|Required. String expression being searched.
|Required. String expression being searched for.
|Optional. Numeric expression that sets the starting position for each search. If omitted, -1 is used, which means that the search begins at the last character position. If start contains Null, an error occurs.
|Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. If omitted, a binary comparison is performed. See the Settings section for values.
The compare argument can have the following values:
|Performs a comparison by using the setting of the Option Compare statement.
|Performs a binary comparison.
|Performs a textual comparison.
|Microsoft Access only. Performs a comparison based on information in your database.
InStrRev returns the following values:
|stringcheck is zero-length
|stringcheck is Null
|stringmatch is zero-length
|stringmatch is Null
|stringmatch is not found
|stringmatch is found within stringcheck
|Position at which match is found
|start > Len(stringcheck)
Note that the syntax for the InstrRev function is not the same as the syntax for the Instr function.
InstrRev will not find an instance of stringmatch unless the position of the end character of stringmatch is less than or equal to start.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.