1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| Sub vérification()
Dim Num_serie As String
Dim Derlig
Dim Derlig2
Dim test As Integer
Dim test2 As Integer
Dim test3 As Integer
Dim test4 As Integer
Dim test5 As Integer
Dim test6 As Integer
Dim test7 As Integer
Dim test8 As Integer
Dim testnum As String
test = 0
test2 = 0
test3 = 0
test4 = 0
test5 = 0
test6 = 0
test7 = 0
test8 = 0
Derlig = Sheets("RESULTAT").Range("A65536").End(xlUp).Row
For i = 2 To Derlig
test = i 'test
If Range("F" & i) = 0 Then
test2 = test2 + 1 'test
Num_serie = Range("C" & i).Value
Range("Q" & i) = Num_serie
Worksheets("IMPORT_BROTHER").Select
Dernlig2 = Sheets("IMPORT_BROTHER").Range("A65536").End(xlUp).Row
For a = 2 To Dernlig2
test3 = a 'test
If Num_serie = Range("I" & a).Value Then
test4 = 1 'test
If Sheets("IMPORT_BROTHER").Range("J" & a).Value > Sheets("RESULTAT").Range("D" & i).Value & Sheets("IMPORT_BROTHER").Range("K" & a).Value < Sheets("RESULTAT").Range("E" & i).Value Then
Sheets("SORTIE").Range("F" & i).Value = Sheets("IMPORT_BROTHER").Range("P" & a).Value
test5 = 1 'test
Else
If Sheets("IMPORT_BROTHER").Range("J" & a).Value < Sheets("RESULTAT").Range("D" & i).Value & Sheets("IMPORT_BROTHER").Range("K" & a).Value < Sheets("RESULTAT").Range("E" & i).Value Then
Sheets("SORTIE").Range("F" & i).Value = Sheets("IMPORT_BROTHER").Range("P" & a).Value
test6 = 1 'test
Else
If Sheets("IMPORT_BROTHER").Range("J" & a).Value > Sheets("RESULTAT").Range("D" & i).Value & Sheets("IMPORT_BROTHER").Range("K" & a).Value > Sheets("RESULTAT").Range("E" & i).Value Then
Sheets("SORTIE").Range("F" & i).Value = Sheets("IMPORT_BROTHER").Range("P" & a).Value
test7 = 1 'test
Else
If Sheets("IMPORT_BROTHER").Range("J" & a).Value < Sheets("RESULTAT").Range("D" & i).Value & Sheets("IMPORT_BROTHER").Range("K" & a).Value > Sheets("RESULTAT").Range("E" & i).Value Then
Sheets("SORTIE").Range("F" & i).Value = Sheets("IMPORT_BROTHER").Range("P" & a).Value
test8 = 1 'test
End If
End If
End If
End If
End If
Next a
Worksheets("SORTIE").Select
End If
Next i
Sheets("SORTIE").Range("O1") = test
Sheets("SORTIE").Range("O2") = test2
Sheets("SORTIE").Range("O3") = test3
Sheets("SORTIE").Range("O4") = test4
Sheets("SORTIE").Range("P1") = test5
Sheets("SORTIE").Range("P2") = test6
Sheets("SORTIE").Range("P3") = test7
Sheets("SORTIE").Range("P4") = test8
Sheets("SORTIE").Range("O5") = Num_serie
Sheets("SORTIE").Range("O6") = Range("F" & i).Value
End Sub |
Partager