Private Sub Command1_Click()
Dim i As Integer
Dim intCount As Integer
Dim a As String
Dim blnT As Boolean
a = "123542132"
For i = 1 To Len(a)
If blnT Then
intCount = intCount + 1
End If
If Mid(a, i, 1) = "2" Then
blnT = True
If intCount > 1 Then
Me.Print intCount - 1
End If
intCount = 0
End If
Next i
End Sub