andyakira
asked on
Whats wrong with my code! its not working 500 Points.
Dim text1x As String
Dim Text2x As String
Dim Text3x As String
Dim aText() As String
Dim i As Integer
For i = 0 To List1.ListCount - 1
aText = Split(List1.List(i), " ")
On Error Resume Next
text1x = aText(0)
Text2x = aText(1)
If Text2x > 10 Then
List2.AddItem List1.List(i)
Frame3.Caption = List2.ListCount
End If
Next i
-------------------------- ---
The list1.listbox has items like this name<space>number:
andy 12
sam 13
jason 100
maria 200
Im trying to split the name and the number, and if the number is greater then 10, it adds to list2.
its not working out, its adding names under 10 and names over 10. i dont understand why. any suggestions.
Dim Text2x As String
Dim Text3x As String
Dim aText() As String
Dim i As Integer
For i = 0 To List1.ListCount - 1
aText = Split(List1.List(i), " ")
On Error Resume Next
text1x = aText(0)
Text2x = aText(1)
If Text2x > 10 Then
List2.AddItem List1.List(i)
Frame3.Caption = List2.ListCount
End If
Next i
--------------------------
The list1.listbox has items like this name<space>number:
andy 12
sam 13
jason 100
maria 200
Im trying to split the name and the number, and if the number is greater then 10, it adds to list2.
its not working out, its adding names under 10 and names over 10. i dont understand why. any suggestions.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it works for smaller lists, im using a list with 2000 names. it messes up.
ASKER
yours worked, it looks the same as the code i was using.. i dont get it :D
I tried your code with an entry of sam 9 and it didnt add to the listbox so your code seems to work for me.
maybe you could try If CInt(Text2x) > 10 Then
this should make sure that Text2x is an integer for the comparison
HTH
Scott