Voila les modifications que jai effectué
Private Sub UserForm_Initialize()
Dim i As Integer
Dim a As Integer
a = 2
Sheets("Feuille1").Select
Do While Range("C" & a) <> ""
If Range("J" & a).Value < Range("K" & a).Value Then
Range("AH" & a).Value = "CRITIQUE"
ElseIf Range("J" & a).Value > Range("AG" & a).Value Then
Range("AH" & a).Value = "COMFORTABLE"
ElseIf Range("K" & a).Value < Range("J" & a).Value < Range("AG" & a).Value Then
Range("AH" & a).Value = "URGENT"
End If
a = a + 1
Loop
With Me.ListView1
With .ColumnHeaders
.Clear
.Add , , "Désignation", 112
.Add , , "Référence", 112
.Add , , "Quantité", 112
.Add , , "Stock minimum", 112
.Add , , "Point de Cmd", 112
.Add , , "Etat du stock", 112
End With
.Gridlines = True
.View = lvwReport
tblBD = Range("A6:A65000,C6:C65000,J6:K65000,AF6:AG65000".End(xlUp).Row).Value
ligne = 0
For i = 1 To UBound(tblBD)
ligne = ligne + 1
.ListItems.Add , , tblBD(i, 1)
.ListItems(ligne).ListSubItems.Add , , tblBD(i, 2)
.ListItems(ligne).ListSubItems.Add , , tblBD(i, 3)
.ListItems(ligne).ListSubItems.Add , , tblBD(i, 4)
.ListItems(ligne).ListSubItems.Add , , tblBD(i, 5)
.ListItems(ligne).ListSubItems.Add , , tblBD(i, 6)
Next
End With
For x = 1 To ListView1.ListItems.Count
If ListView1.ListItems(x).ListSubItems(3).Text = "CONFORTABLE" Then
ListView1.ListItems(x).ListSubItems(3).ForeColor = RGB(0, 160, 0) 'vert
End If
If ListView1.ListItems(x).ListSubItems(3).Text = "CRITIQUE" Then
ListView1.ListItems(x).ListSubItems(3).ForeColor = RGB(224, 96, 0) 'orange
End If
If ListView1.ListItems(x).ListSubItems(3).Text = "URGENT" Then
ListView1.ListItems(x).ListSubItems(3).ForeColor = RGB(255, 0, 0) 'rouge
End If
If ListView1.ListItems(x).ListSubItems(3).Text = "" Then
ListView1.ListItems(x).ListSubItems(3).ForeColor = xlNone
End If
Next x
End Sub