***************************************************************
文字列の右端で指定値をカウント
【引数】Value :対象の文字列
Find :検索値
Compare :文字列判定方法(VbCompareMethodに準拠)
***************************************************************
Public Function fString_Right_Count(Value As String, Find As String, Optional Compare As VbCompareMethod = vbBinaryCompare) As Long
Dim Cnt As Long
Dim Len_Cnt As Long
Dim At_Cnt As Long
Dim At_Fnd As Long
If Value = "" Or Find = "" Then Exit Function
Len_Cnt = Len(Find)
At_Cnt = Len(Value)
If At_Cnt < Len_Cnt Then Exit Function
Do
At_Fnd = InStrRev(Value, Find, At_Cnt, Compare)
If At_Fnd <> At_Cnt - Len_Cnt + 1 Then Exit Do
Cnt = Cnt + 1
At_Cnt = At_Fnd - 1
If At_Cnt < Len_Cnt Then Exit Do
Loop
fString_Right_Count = Cnt
End Function