I am having a problem on how to count numbers inside text area. . .

example: In my text area I have 10 numbers.

12, 06, 31, 22, 53, 28, 96, 71, 10, 47

the the program should count how many 0,1,2,3,4....9 excluding the comma. I don't know how to do this inside a text area or a multiline text box. Can anyone help me or give an example or idea on how to do this. . . .please.

try this:

Sub xx()
    Dim txt As String
    Dim x As Variant
    Dim i As Long
    txt = "10,11,12,13,14,15,16,17,18,1,2,3,4"
    x = Split(txt, ",")
    For i = 0 To UBound(x): Next i
    MsgBox "There are " & i & " numbers in your text area"
End Sub

try this:

Sub xx()
    Dim txt As String
    Dim x As Variant
    Dim i As Long
    txt = "10,11,12,13,14,15,16,17,18,1,2,3,4"
    x = Split(txt, ",")
    For i = 0 To UBound(x): Next i
    MsgBox "There are " & i & " numbers in your text area"
End Sub

Ahhh....

Why not just use ubound+1?

Sub xx()
    Dim txt As String
    Dim x As Variant
    Dim i As Long
    txt = "10,11,12,13,14,15,16,17,18,1,2,3,4"
    x = Split(txt, ",")
    MsgBox "There are " & UBound(x) + 1 & " numbers in your text area"
End Sub

Good Luck

This question has already been answered. Start a new discussion instead.