Private Sub CommandButton1_Click()
Dim Total As Single 'déclare la variable Total
Dim i As Integer
If Me.Cbx_article.ListIndex >= 0 And Me.Txt_nombre <> "" Then
If Me.Liste_cde.ListCount >= 10 Then 's'il y a plus de 10 articles
MsgBox "Vente limitée à 10 lignes !"
Else
'Rechercher dans article
'Part_prix = Application.VLookup(Me.Cbx_article, Sheets(4).Range("c:i"), 4, 0)
'Part_stock = Application.VLookup(Me.Cbx_article, Sheets(4).Range("c:i"), 3, 0)
' BIEN QUE LA JE PIGE PAS LE BESOINS D4ALLER ENCORE CHERCHER
' PUISQUE LES 2 VARIABLE SONT EN GLOBAL ET DONC DEJA RENSEIGNEE
'MAIS BON COMME TU VEUX lol lol et encore lol
With Application: ligne = .IfError(.Match(Me.Cbx_article, Sheets(4).[c:c], 0), 0)
If ligne > 0 Then
Part_prix = Sheets(4).Cells(ligne, "F").Value
Part_stock = Sheets(4).Cells(ligne, "E")
End If
End With
'Remplir la zone de liste
With Me.Liste_cde
.AddItem
.List(memoire, 0) = Me.Cbx_article
.List(memoire, 1) = Part_stock
.List(memoire, 2) = Me.Txt_nombre
.List(memoire, 3) = CCur(Part_prix) & " €"
.List(memoire, 4) = CCur(CCur(Part_prix) * Me.Txt_nombre) & " €"
End With
memoire = memoire + 1
'vider l'article et le nombre
Me.Cbx_article = ""
Me.Txt_nombre = ""
End If
End If
With Liste_cde 'prend en compte la Liste_cde (à adapter)
For i = 0 To .ListCount - 1 'boucle sur tous les lignes de la ListBox1
Total = Total + .Column(4, i) 'définit le Total (à adapter car tu parles de la colonne 7 et la c'est la "7ème" colonne)
Next i 'prochaine ligne de la boucle
Me.Label_total.Caption = CCur(Total) & " €" 'renvoie dans la Label_total le Total
'Range("A11").Resize(.ListCount, .ColumnCount) = .List 'renvoie la da la cellule A1 la les éléments de la ListBox1
End With 'fin de la prise en compte de la ListBox1
End Sub