***************************************************************
文字列をカウント
※様々な方法から、最速の方法でカウント
【引数】Value :検索対象の文字列
Find :検索値
Compare :文字列判定方法(VbCompareMethodに準拠)
***************************************************************
Public Function fString_Count(Value As String, Find As String, Optional CompareMode As VbCompareMethod = vbBinaryCompare) As Long
'文字列内の指定文字をカウント
'200万Hit:0.30s
If Len(Value) = 0 Then Exit Function
Dim Ln As Long
Ln = Len(Find)
If Ln = 0 Then Exit Function
Dim Start As Long
Start = 1
Do
Start = InStr(Start, Value, Find, CompareMode) + Ln
If Start = Ln Then Exit Do
Dim Cnt As Long
Cnt = Cnt + 1
Loop
fString_Count = Cnt
End Function