Public Function CompterVal(plage As Range, str, _
Optional CaseSensitive As Boolean = False, _
Optional Debut As Boolean = False, _
Optional Fin As Boolean = False) As Integer
Dim data, Regex As Object, matches As Object
CompterVal = 0
data = "|" & Join(Application.Transpose(plage.Value), "|") & "|"
Set Regex = CreateObject("VBScript.RegExp")
Regex.Pattern = str
Regex.Global = True
Regex.IgnoreCase = Not CaseSensitive
If Debut Then Regex.Pattern = "\|" & str
If Fin Then Regex.Pattern = str & "\|"
Set matches = Regex.Execute(data)
CompterVal = matches.Count
Set matches = Nothing: Set Regex = Nothing
End Function