devxlogo

Repeat Performance

Repeat Performance

A simple loop through your main string lets you count the occurrences of a specified character or string. This function is useful for determining if enough commas appear in your comma-delimited string:

 Function Tally(sText As String, sFind As String) As Long	Dim lFind As Long	Dim lLast As Long	Do		lFind = InStr(lLast + 1, sText, sFind)		If lFind Then			lLast = lFind			Tally = Tally + 1		End If	Loop Until lFind = 0End Function

devx-admin

Share the Post: