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
|
On Error Resume Next
If Me.txt_total.Value = "" Then Exit Sub
Sheets("commande").Select
Dim i As Byte, Indice As Byte, derlig As Integer
Dim recap As Worksheet
Set recap = Worksheets("recap")
With Worksheets("commande")
derlig = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 1 To 10
If Controls("cmb_ref" & Format(i, "00")) <> "" Then
Indice = Indice + 1
.Range("A" & Indice + derlig) = Controls("cmb_ref" & Format(i, "00"))
.Range("b" & Indice + derlig) = Controls("txt_categorie" & Format(i, "00"))
.Range("c" & Indice + derlig) = Controls("txt_type" & Format(i, "00"))
.Range("d" & Indice + derlig) = Controls("txt_lib" & Format(i, "00"))
.Range("e" & Indice + derlig) = Controls("txt_kilo_carton" & Format(i, "00"))
.Range("f" & Indice + derlig) = Controls("txt_kilo_detail" & Format(i, "00"))
.Range("g" & Indice + derlig) = Controls("txt_poids" & Format(i, "00")) * 1
.Range("h" & Indice + derlig) = Controls("txt_cond" & Format(i, "00")) * 1
.Range("i" & Indice + derlig) = Controls("txt_prix_carton" & Format(i, "00")) * 1
.Range("j" & Indice + derlig) = Controls("txt_prix_detail" & Format(i, "00")) * 1
.Range("k" & Indice + derlig) = Controls("txt_kilopromo_carton" & Format(i, "00"))
.Range("l" & Indice + derlig) = Controls("txt_kilopromo_detail" & Format(i, "00"))
.Range("m" & Indice + derlig) = Controls("txt_prixpromo_carton" & Format(i, "00")) * 1
.Range("n" & Indice + derlig) = Controls("txt_prixpromo_detail" & Format(i, "00")) * 1
.Range("o" & Indice + derlig) = Controls("txt_quant" & Format(i, "00")) * 1
.Range("p" & Indice + derlig) = Controls("txt_tot" & Format(i, "00")) * 1
.Range("q" & Indice + derlig) = txt_nom
End If
Next
End With
'remplir le recap
recap.Range("a65536").End(xlUp).Offset(1, 0).Value = Me.txt_nom.Value
recap.Range("B65536").End(xlUp).Offset(1, 0).Value = Me.txt_total.Value * 1
Unload Me
ActiveWorkbook.Save
End Sub |
Partager