Private Sub Cbn_Facturer_Click()
Dim oldindex
With Sheets("FACTURE")
oldindex = .[E6].Text
.[E6] = Format(Val(Replace(.[E6], "F", "")) + 1, """F""0000")
Range("D9:D14,D7:E7,B20:E35,E37,E39,B44").ClearContents
Id = Cbx_Client
X = WorksheetFunction.Match(Id, Range("t_Clients").Columns(1).Cells, 0)
prenom = Range("t_Clients").Cells(X, 3)
Addr = Range("t_Clients").Cells(X, 4)
cdp = Range("t_Clients").Cells(X, 5)
ville = Range("t_Clients").Cells(X, 6)
.[d7] = Date
.[D9] = Tbx_Raison & " " & prenom
.[D10] = Addr
.[D11] = ville
.[D12] = cdp
.[B41] = "Référence devis: " & Cbx_Devis
.[B42] = "Date devis: " & Tbx_DateDevis
tb = ListBX.List
.[B20].Resize(ListBX.ListCount, 4).Value = tb
.[B38,E37,E39].Value = CDbl(Tbx_MontantHTDevis)
DoEvents
If MsgBox("Voulez vous imprimer la facture ?", vbYesNo) Then
Me.Hide
.PrintPreview
Me.Show
With Range("memofacture").ListObject.ListRows.Add.Range
.Cells(1) = Sheets("FACTURE").[E6]
.Cells(2) = Cbx_Devis
End With
Else
.[E61] = oldindex
End If
End With
End Sub