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
| Private Sub CommandButton24_Click()
TextBox1 = "Coca Cola"
If TextBox1 = "" Or TextBox2 = "" Then
MsgBox "Vous devez impérativement remplir la quantitée et l'article avant de valider", vbInformation
Exit Sub
End If
dlf_bdd = Sheets("BDD").Range("a" & Rows.Count).End(xlUp).Row
Set Table = Sheets("BDD").Range("b2:c" & dlf_bdd)
With Sheets("Temp")
dlf = .Range("a" & Rows.Count).End(xlUp).Row + 1
.Range("a" & dlf) = Date
.Range("b" & dlf) = CDbl(TextBox2)
.Range("c" & dlf) = TextBox1
.Range("d" & dlf) = .Range("b" & dlf) * Application.WorksheetFunction.VLookup(.Range("c" & dlf), Table, 2, 0)
End With
ListBox1.AddItem (TextBox1 & " x " & TextBox2)
TextBox1 = ""
TextBox2 = ""
With Sheets("Temp")
dlf = .Range("a" & Rows.Count).End(xlUp).Row
If dlf > 1 Then
For i = 2 To dlf
Total = Total + .Range("d" & i)
Next i
End If
End With
TextBox4 = Format(Total, "Currency")
End Sub |
Partager