Routine Archive

Parameters:findin As String, tofind As String
Description: Find a character in a string, only backwards

Function RevInStr(findin As String, tofind As String) As Integer
    ' Chris Rae's VBA Code Archive -
    Dim findcha As Integer
    For findcha = Len(findin) - Len(tofind) + 1 To 1 Step -1
        If Mid(findin, findcha, Len(tofind)) = tofind Then
            RevInStr = findcha
            Exit Function
        End If
    Next findcha
    ' Defaults to zero anyway (tsk, tsk, etc)
End Function

You're free to use these routines for anything you want - all I ask is that for commercial use you give me credit somewhere. You may instead want to head back to the index for my Visual Basic for Applications Pages or the main routines archive page.