Option Explicit
Dim NbVendeur As Integer, Vendeur, Facturation, Succursale, Log, MoisFact, Categorie, Paye, Maison, Garant1, Garant2, Statut
Private Sub CommandButton3_Click()
Dim i As Long, dl As Long
dl = Sheets("100").Range("A" & Rows.Count).End(xlUp).Row + 1
If Me.TextBox_NO_CONTRAT = "" Then
MsgBox "Veuillez saisir le numéro de contrat!", vbCritical, "ENREGISTREMENT DONNEES"
Exit Sub
End If
With Sheets("100")
On Error Resume Next
.Cells(dl, 1) = Me.TextBox_NO_CONTRAT
If IsDate(Me.TextBox_DATE_CONTRAT) Then .Cells(dl, 2) = CDate(Me.TextBox_DATE_CONTRAT)
.Cells(dl, 3) = Me.ComboBoxMOIS_FACTURATION
.Cells(dl, 4) = Me.TextBox_NO_TAG
.Cells(dl, 5) = Me.ComboBox_LOG
.Cells(dl, 6) = Me.ComboBox_SUCCURSALE
.Cells(dl, 7) = Me.ComboBox_CATÉGORIE
.Cells(dl, 8) = Me.ComboBox_STATUT
.Cells(dl, 9) = Me.ComboBox_PAYE
.Cells(dl, 10) = Me.ComboBox_MAISON
.Cells(dl, 11) = Me.TextBoxN_NOM_CLIENT
.Cells(dl, 12) = Me.TextBox_MARQUE
.Cells(dl, 13) = Me.TextBox_MODELE
.Cells(dl, 14) = Me.TextBoxNO_SERIE
.Cells(dl, 15) = Me.TextBox_VENDANT
.Cells(dl, 16) = Me.TextBox_COUTANT
.Cells(dl, 17) = Me.TextBox9
.Cells(dl, 18) = Me.TextBox10
.Cells(dl, 19) = Me.TextBox11
.Cells(dl, 20) = Me.ComboBox_VENDEUR
.Cells(dl, 21) = Me.ComboBox_GERANT_1
.Cells(dl, 22) = Me.ComboBoxGERANT_2
.Cells(dl, 23) = Me.TextBox_COMMISSION
.Cells(dl, 24) = Me.TextBox_COMMISSIONS_TAUX
End With
MsgBox "Données enregistrées!", vbInformation, "ENREGISTREMENT DONNEES"
End Sub
Private Sub UserForm_Initialize()
Dim n As Integer
Vendeur = Sheets("200").Range("B5:B" & Sheets("200").[B65000].End(xlUp).Row).Value
Me.ComboBox_VENDEUR.List = Vendeur
Succursale = Sheets("200").Range("D5:D" & Sheets("200").[D65000].End(xlUp).Row).Value
Me.ComboBox_SUCCURSALE.List = Succursale
Log = Sheets("200").Range("i5:i" & Sheets("200").[i65000].End(xlUp).Row).Value
Me.ComboBox_LOG.List = Log
MoisFact = Sheets("200").Range("f5:f" & Sheets("200").[f65000].End(xlUp).Row).Value
Me.ComboBoxMOIS_FACTURATION.List = MoisFact
Categorie = Sheets("200").Range("e5:e" & Sheets("200").[e65000].End(xlUp).Row).Value
Me.ComboBox_CATÉGORIE.List = Categorie
Paye = Sheets("200").Range("h5:h" & Sheets("200").[h65000].End(xlUp).Row).Value
Me.ComboBox_PAYE.List = Paye
Maison = Sheets("200").Range("g5:g" & Sheets("200").[g65000].End(xlUp).Row).Value
Me.ComboBox_MAISON.List = Maison
Garant1 = Sheets("200").Range("c5:c" & Sheets("200").[c65000].End(xlUp).Row).Value
Me.ComboBox_GERANT_1.List = Garant1
Statut = Sheets("200").Range("L5:L" & Sheets("200").[L65000].End(xlUp).Row).Value
Me.ComboBox_GERANT_1.List = Statut
Me.ComboBoxGERANT_2 = "pas de source" 'à partir d'où faut-il extraire les données
'Stop
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub