Private Sub Valider_et_saisir_Click()
Call Module3.Déprotege
With Sheets("Base de données")
.ListObjects("Tbase").ListRows.Add 'ajoute une ligne à la table "TBase")
lastline = .ListObjects("Tbase").DataBodyRange.Rows.Count 'récupère le nombre de ligne au total ==> la dernière est vide
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 1) = Me.Txtnom
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 2) = Me.Txtprenom
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 4) = Me.Txtentreprise
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 5) = Me.Txtsiret
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 6) = Me.Cbxopco
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 8) = Format(Me.Txtdebut, "DD/MM/YYYY") 'format de date
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 9) = Format(Me.Txtfin, "DD/MM/YYYY") 'format de date
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 21) = Me.Cbxdiplome
.ListObjects("Tbase").DataBodyRange.Cells(lastline, 22) = Me.Cbxsite
End With
With Sheets("thr")
.ListObjects("Tthr").ListRows.Add
lastline = .ListObjects("Tthr").DataBodyRange.Rows.Count
.ListObjects("Tthr").DataBodyRange.Cells(lastline, 1) = Me.Txtnom
.ListObjects("Tthr").DataBodyRange.Cells(lastline, 1) = Me.Txtprenom
End With
With Sheets("caisse à outils")
.ListObjects("TCaisse").ListRows.Add
lastline = .ListObjects("TCaisse").DataBodyRange.Rows.Count
.ListObjects("TCaisse").DataBodyRange.Cells(lastline, 1) = Me.Txtnom
.ListObjects("TCaisse").DataBodyRange.Cells(lastline, 2) = Me.Txtprenom
.ListObjects("TCaisse").DataBodyRange.Cells(lastline, 3) = Me.Cbxdiplome
.ListObjects("TCaisse").DataBodyRange.Cells(lastline, 4) = Me.Cbxsite
.ListObjects("TCaisse").DataBodyRange.Cells(lastline, 6) = Me.Txtalertecaisse
End With
Me.Txtinitiales = "" 'la valeur de la celulle active est = a la textbox de ce formulaire(me)
Me.Txtnom = ""
Me.Txtprenom = ""
Me.Txtentreprise = ""
Me.Txtsiret = ""
Me.Cbxopco = ""
Me.Txtdebut = ""
Me.Txtfin = ""
Me.Cbxdiplome = ""
Me.Cbxsite = ""
Me.Txtalertecaisse = ""
End Sub