
Originally Posted by
RenderMan
You need to step through the list of texts (one-at-a-time), and store the individual numbers to a variable list, *IF* that number does not already belong to the variable list.
Then report the value of the variable list, the count of different numbers, etc..
Hope this helps!
For sure!
Thank you very much
I learned to use the collection object, and I wrote this.
Code:
Private Sub CommandButton1_Click()
Me.Hide
Dim txt(1 To 8) As Double
Dim database As New Collection
txt(1) = TextBox1.Text
txt(2) = TextBox2.Text
txt(3) = TextBox3.Text
txt(4) = TextBox4.Text
txt(5) = TextBox5.Text
txt(6) = TextBox6.Text
txt(7) = TextBox7.Text
txt(8) = TextBox8.Text
Dim I As Integer
Dim J As Integer
For J = 1 To 8
For I = 1 To 8
If txt(J) <> txt(I) Then
If Find(database, txt(J)) Then
Else
database.Add (txt(J))
End If
Else
End If
Next I
Next J
MsgBox database.Count, vbOKOnly, "contatore"
Me.Show
End Sub
Function Find(database As Collection, valore As Double) As Boolean
For k = 1 To database.Count
If database.Item(k) = valore Then
Find = True
Exit For
End If
Next
End Function
Now it works!
Bookmarks