'###############################################################
'函数作用:从右边开始查找指定字符在字符串中的位置
'###############################################################
Public Function MyInStrRev(MainStr As String, SubStr As String) As Integer
Dim Counter As Integer
Dim Success As Boolean
If VBA.Len(MainStr) < VBA.Len(SubStr) Then
MyInStrRev = 0
Else
For Counter = VBA.Len(SubStr) To VBA.Len(MainStr)
If VBA.Left(VBA.Right(MainStr, Counter), VBA.Len(SubStr)) = SubStr Then
Success = True
Exit For
End If
Next Counter
If Success Then
MyInStrRev = VBA.Len(MainStr) ‐ Counter + 1
Else
MyInStrRev = 0
End If
End If
End Function
联系客服