1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Sub verification()
Dim ValPrec As String, ValSuivante As String, CompareVals as string
Dim i as integer, n as integer
Chrono = ";MF 135 U;MM 71135 U;MM 31762/40;MF 345 U;MM 71791/40;MM 71791/50;MPA 1;PA 71155;MF 50 U;MM 71150 U;MF 160 U;MM RH 71160 U;MM 71160 U;MM 71718/60;MF 360 U;MM 71791/60;MF 370 U;MM 71791/70;MF 175 U;MF 180 U;MF 135 1U;MF 31787;MM 1732 P45;MF 40 U;MF 8150 U;MF 60 U;MF 8160 U;MF 8160 USP;MF 8360 U;MF 8170 U;MF 8370 U;MF 940 U;"
Dim n
n = 1
For i = 5 to 58
'Recherche de la valeur précédente
Do While Cells(i, 3).offset(-n,0).Value = "" or i - n <= 5
n = n + 1
loop
if not i - n < 5 then 'une donnée a été trouvée avant la ligne 4
ValPrec = Cells(i, 3).offset(n,0).Value
Do While Cells(i, 3).Value = "" or i <= 58
i = i + 1
loop
if Cells(i, 3).Value <> "" then ValSuivante = Cells(i, 3).Value
CompareVals = ";" & ValPrec & ";" & ValSuivante & ";"
If not Chrono Like "*" & CompareVals & "*" Then MsgBox ("Probleme a la cellule C " & i)
endif
next i
End sub |