Merci pour votre aide (j'ai d'autres questions mais on va déjà commencer par ça, un grand merci d'avance),
> Forum > Visual Basic 6
dérivés > VBA
j'au une msgbox par comparaison hors ce que je souhaite c'est avoir une seule msgbox qui incrémente si besoin tous les <3 et <1 suivant la ou les ref en limite de stock
Dim i, StockZero, StockFaible As Long StockFaible = 0 StockZero = 0 For i = 1 To 20 If Range("k" & i).Value <> "" Then If Range("K" & i).Value < 1 Then StockZero = StockZero + 1 Range("K" & i).Font.Color = vbRed Else If Range("K" & i).Value < 3 Then StockFaible = StockFaible + 1 Range("K" & i).Font.Color = vbGreen End If End If End If Next i If StockFaible > 0 Or StockZero > 0 Then MsgBox "Vous avez " & StockFaible & " articles qui finissent, et " & StockZero & " articles à zéro" End If
Dim i, StockZero, StockFaible As Long Dim Ref(20) As String StockFaible = 0 StockZero = 0 For i = 1 To 20 If Range("k" & i).Value <> "" Then If Range("K" & i).Value < 1 Then StockZero = StockZero + 1 Range("K" & i).Font.Color = vbRed Ref(i) = Range("L" & i).Value 'L' C'est la colonne qui contient les références Else If Range("K" & i).Value < 3 Then StockFaible = StockFaible + 1 Range("K" & i).Font.Color = vbGreen Ref(i) = Range("L" & i).Value End If End If End If Next i If StockFaible > 0 Or StockZero > 0 Then Dim Msg As String Msg = "Vous avez " & StockFaible & " articles qui finissent, et " & StockZero & " articles à zéro:" & vbCrLf For i = 0 To 19 If Len(Ref(i)) > 0 Then Msg = Msg & Ref(i) & vbCrLf Next i MsgBox Msg End If
comment modifier cette partie du prog pour obtenir par exemple les infos de la colonne M en plus de la L?
Ref(i) = Range("L" & i).Value & " - " & Range("M" & i).Value