Hi,
Iam trying to create a small pick 4 program where i want to find out how many
times a numer falls whithing a group of numbers.
For example if I have numbers 0 to 9 and then divide this numbers in 4 groups
0 to 2, 3 to 4, 5 to 5 and 7 to 9. and if the number I want to use is 1224, what I would like for the program to show is: 0 to 2 = 3 and 3 to 4 = 1.
Here I include the code that Iam using.Code:Private Sub CheckForSeconds() note: Iam getting the value from another Flexgrid on form1. Dim i3 As Integer Dim c3(10) As Integer Dim d3 As Integer c3(1) = 0 c3(2) = 0 c3(3) = 0 c3(4) = 0 With Form1.Grid1 For i3 = 1 To .Rows - 1 For d3 = 1 To 4 If .TextMatrix(i3, d3) <= 2 Then 'values 0-1-2 c3(1) = 1 Grid1.TextMatrix(i3, 4) = c3(1) + 1 End If If .TextMatrix(i3, d3) = 3 Or .TextMatrix(i3, d3) = 4 Then 'values 3-4 c3(2) = 1 Grid1.TextMatrix(i3, 5) = c3(2) + 1 End If If .TextMatrix(i3, d3) = 5 Or .TextMatrix(i3, d3) = 6 Then 'values 5-6 c3(3) = 1 Grid1.TextMatrix(i3, 6) = c3(3) + 1 End If If .TextMatrix(i3, d3) > 6 Then 'values 7-8-9 c3(4) = 1 Grid1.TextMatrix(i3, 7) = c3(4) + 1 End If Next Next End With End Sub





Reply With Quote