Put the following ( between the dashed lines) in a MODULE.
I have wrapped lines using the sequence <space>underline so that it should
fit in the board posting. Unwrap the lines if you like.
----------------------------------
Public Function Load_Array_from_String( _
str_Input As String, _
str_Delimiter As String, _
strary_Output() As String) _
As Integer
Dim I As Integer
Dim I_Last As Integer
Dim N As Integer
Dim str_TempIn As String
Dim L_TempIn As Integer
Dim L_Delim As Integer
Dim Found_At As Integer
str_TempIn = Trim(str_Input)
L_TempIn = Len(str_TempIn)
L_Delim = Len(str_Delimiter)
I_Last = L_TempIn - L_Delim + 1
For I = 1 To I_Last
If Mid$(str_TempIn, I, L_Delim) = _
str_Delimiter Then N = N + 1
Next I
N = N + 1 ' There will always be at least one output
ReDim strary_Output(N)
I = 0
Found_At = _
InStr(str_TempIn, str_Delimiter)
While Found_At > 0
If Found_At = 1 Then
I = I + 1
strary_Output(I) = ""
Else
I = I + 1
strary_Output(I) = _
Mid$(str_TempIn, 1, Found_At - 1)
End If
If Found_At + L_Delim <= L_TempIn Then
str_TempIn = Mid$(str_TempIn, _
Found_At + L_Delim)
L_TempIn = Len(str_TempIn)
Else
str_TempIn = ""
L_TempIn = 0
GoTo Done
End If
Found_At = InStr(str_TempIn, _
str_Delimiter)
Wend
Done:
If Len(str_TempIn) > 0 Then
I = I + 1
strary_Output(I) = str_TempIn
End If
Load_Array_from_String = N
End Function
Public Function CountNumbers(strIn As String, D As String) As Integer
Dim I as Integer
Dim N As Integer
Dim C As Integer
Dim strResult() As String
C = 0
N = Load_Array_from_String(strIn,D,strResult)
For I = 1 to N
If IsNumeric(strResult(I) Then
C = C + 1
End If
Next I
CountNumbers = C
End Function
-----------------------------
N = CountNumbers("X;0;5;10;30;Y;45",";")
N will have value of 5, it will skip over the X and Y