DreamLax,
Thanks for the tips here is the updated function -
VB Code:
Private Function InstrCount(ByVal Expression As String, _ ByVal Find As String, _ Optional ByVal Start As Long = 1, _ Optional Compare As VbCompareMethod = vbBinaryCompare) As Long Dim Temp$, h As Long If LenB(Find) Then ' check for zero length find; avoid div by zero Temp$ = Replace$(Expression, Find, "", Start, -1, Compare) h = CLng(LenB(Expression) - LenB(Temp$)) h = CLng(h \ LenB(Find)) End If InstrCount = h End Function
Regards Allan




Reply With Quote