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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
public compte_false as integer
public compte_miss as integer
Sub controle_données()
Feuil1.Select
Dim pourcent As Double
Dim nb_ligne As Integer
Dim i As Integer
Dim n As Integer
Application.ScreenUpdating = False
Do
nb_ligne = nb_ligne + 1
'Loop Until nb_ligne = 15
Loop Until Cells(nb_ligne, 1) = ""
Range("2:" & nb_ligne).ClearComments
Range("2:" & nb_ligne).ClearFormats
compte_false = 0
compte_miss = 0
'Tar pM
i = 2
Do
n = Len(Cells(i, 3).Value)
If n > 3 Then
Cells(i, 3).Interior.Color = RGB(0, 0, 0)
Cells(i, 3).Font.Color = RGB(255, 255, 255)
Cells(i, 3).Font.Bold = True
Cells(i, 3).AddComment
Cells(i, 3).Comment.Text Text:="Il ne doit pas y avoir plus de 3 caractère dans cette cellule"
i = i + 1
compte_false = compte_false + 1
Else
i = i + 1
End If
Loop Until i = nb_ligne
pourcent = 20
Application.StatusBar = "Patientez: traitement effectuer à " & pourcent & " %"
'colonne Log N
i = 2
Do
If Cells(i, 5) <> "C" And Cells(i, 5) <> "S" And Cells(i, 5) <> "G" And Cells(i, 5) <> "" Then
Cells(i, 5).Interior.Color = RGB(0, 0, 0)
Cells(i, 5).Font.Color = RGB(255, 255, 255)
Cells(i, 5).Font.Bold = True
Cells(i, 5).AddComment
Cells(i, 5).Comment.Text Text:="Les caractères acceptés sont ""C"", ""S"", ""G"" et case vides "
i = i + 1
compte_false = compte_false + 1
Else
i = i + 1
End If
Loop Until i = nb_ligne
pourcent = 20 + pourcent
Application.StatusBar = "Patientez: traitement effectuer à " & pourcent & " %"
'Code article
i = 2
Do
If Cells(i, 9) = "" Then
Cells(i, 9).Font.ColorIndex = 3
Cells(i, 9).Interior.ColorIndex = 6
Cells(i, 9).Font.Bold = True
Cells(i, 9).AddComment
Cells(i, 9).Comment.Text Text:="Pas de cellules vides autorisées"
i = i + 1
compte_miss = compte_miss + 1
Else
i = i + 1
End If
Loop Until i = nb_ligne
pourcent = 20 + pourcent
Application.StatusBar = "Patientez: traitement effectuer à " & pourcent & " %"
'Article
i = 2
Do
If Cells(i, 10) = "" Then
Cells(i, 10).Font.ColorIndex = 3
Cells(i, 10).Interior.ColorIndex = 6
Cells(i, 10).Font.Bold = True
Cells(i, 10).AddComment
Cells(i, 10).Comment.Text Text:="Pas de cellules vides autorisées"
i = i + 1
compte_miss = compte_miss + 1
Else
i = i + 1
End If
Loop Until i = nb_ligne
pourcent = 20 + pourcent
Application.StatusBar = "Patientez: traitement effectuer à " & pourcent & " %"
'Code EAN
i = 2
Do
n = Len(Cells(i, 13).Value)
If n <> 13 And Cells(i, 13) <> "" Then
Cells(i, 13).Interior.Color = RGB(0, 0, 0)
Cells(i, 13).Font.Color = RGB(255, 255, 255)
Cells(i, 13).Font.Bold = True
Cells(i, 13).AddComment
Cells(i, 13).Comment.Text Text:="Le code EAN doit comporté 13 caractères"
i = i + 1
compte_false = compte_false + 1
Else
i = i + 1
End If
Loop Until i = nb_ligne
Application.ScreenUpdating = true
End Sub |