codice:Dim i As Integer Dim j As Integer Dim n(1 To 50) As Integer Dim sm(1 To 10) As Integer Dim y As Integer Dim lgWhere As Long Dim count As Integer Dim vrNum As Variant For i = 1 To 50 n(i) = adoPrimaryRS(i) Next i ' DISTANZE kb = 1 For i = 1 To 49 For j = i + 1 To 50 sm(kb) = Abs(n(i) + n(j)) If sm(kb) > 90 Then sm(kb) = sm(kb) - 90 For y = 0 To 100 Step 1 Text3(y).Text = sm(kb) ' qui da errore INDICE NN COMPRESO NELL'INTERVALLO kb = kb + 1 count = 0 vrNum = Text3(y).Text For Each vrNum In Text3() lgWhere = StrComp(Text3(y).Text, vrNum, 0) If lgWhere = 0 And count > y Then Text3(y).BackColor = vbGreen vrNum.BackColor = vbGreen End If count = count + 1 Next vrNum Next y Next j Next i