Private Sub BtnSauvegarder_Click()
Dim Matable As Variant
Dim NLigne As Integer
Dim NColonne As Integer
Dim Ws As Worksheet
Dim Derlgn As Long
Dim L As Integer
Set Ws = Feuil8
'On complète la source de données
With Me
With .LstItem 'avec la Listbox
If .ListCount = 0 Then Exit Sub 'on quitte si pas de lignes dans la ListBox
For L = 0 To .ListCount - 1 'pour chaque ligne de la ListBox
Derlgn = Ws.Cells(Ws.Rows.Count, 1).End(xlUp).Row + 1 'on récupére la premiere Ligne vide de la feuille en partant du bas
Ws.Cells(Derlgn, 1) = Format(Trim(.List(L, 0)), "dd/mm/yyyy")'<--- ICI Date
Ws.Cells(Derlgn, 2) = .List(L, 1) 'NumDevis
Ws.Cells(Derlgn, 3) = .List(L, 2) 'NomClient
Ws.Cells(Derlgn, 4) = .List(L, 3) 'Designation
Ws.Cells(Derlgn, 5) = CInt(.List(L, 4)) 'Qte
Ws.Cells(Derlgn, 6) = CCur(.List(L, 5)) 'PrixAchatUnite
Ws.Cells(Derlgn, 7) = .List(L, 6) 'Marge
Ws.Cells(Derlgn, 8) = CCur(.List(L, 7)) ' PrixVenteUnite
Ws.Cells(Derlgn, 9) = CCur(.List(L, 8)) 'PrixVenteTotal
Next L
.Clear
End With
'on vide les controls
.CmbBDesignation.ListIndex = -1
.TxtQte.Value = "0"
.TxtPrixAchatUnite = "0,00"
.TxtMarge = 0
.TxtPrixVenteUnite = "0,00"
.TxtPrixVenteTotal = "0,00"
.TxtB_Commande = "0,00"
End With
Ws.Cells(8, 13) = Ws.Cells(8, 13) + 1
Unload Me
End Sub