CharCount




Private Sub Test()
Const mystr = "This is a test of the split function" returns 6
Debug.Print Occurs(mystr, "t")
End Sub

Public Function Occurs(ByVal strtochk As String, ByVal searchstr As String) As Long
'remember SPLIT returns a zero-based array

Occurs = UBound(Split(strtochk, searchstr)) + 1
End Function










( charcount.html )- by Paolo Puglisi - Modifica del 17/12/2023