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