Replace is a highly used Built-in VBA function
Replace can be used to find the number of occurrences of a string. Function CountString(s As String, sMatch As String) sWork = LCase(s) sWorkMatch = LCase(sMatch) CountString = (Len(s) - Len(Replace(sWork, sWorkMatch, ""))) / Len(sMatch) End Function
|