Private Sub cmdValidenouvellesession_Click()
Dim Derli As Byte 'changer le type en fonction du nombre de lignes
Dim X As Integer, i As Integer 'Variables pour faire la boucle de checking de Duplication
Dim Match As Byte
If txtnumerounique = "" Then MsgBox "Entrer un numéro": Exit Sub
Derli = Sheets("Détail").Range("A65536").End(xlUp).Row + 1 ' On identifie la dernière
For X = 2 To Derli
If txtnumerounique = Sheets("Détail").Range("A" & X) Then
Match = Match + 1: i = X
End If
Next X
'Si il y a Duplication
If Match > 0 Then MsgBox ("Ce numéro est déja existant,Rééssayer "): Exit Sub
With Sheets("Détail")
.Cells(Derli, 1) = txtnumerounique.Value
.Cells(Derli, 2) = ComboBoxentreprise
.Cells(Derli, 3) = ComboBoxref
.Cells(Derli, 4) = ComboBoxintitule
.Cells(Derli, 5) = ComboBoxlieu
.Cells(Derli, 6) = ComboBoxformateur
.Cells(Derli, 7) = txtdatedebut
.Cells(Derli, 8) = txtfin
.Cells(Derli, 9) = txtenvoi
.Cells(Derli, 10) = txtreponse
.Cells(Derli, 11) = ComboBoxopca
.Cells(Derli, 12) = txtduree
.Cells(Derli, 13) = ComboBoxstagiaires
.Cells(Derli, 14) = txtnomstagiaires
.Cells(Derli, 15) = CCur(txtmontantdemande)
.Cells(Derli, 16) = CCur(txttarifhoraire)
.Cells(Derli, 17) = txtattente.Value
.Cells(Derli, 19) = txtattente2.Value
.Cells(Derli, 23) = ComboBoxSuivi
Unload Me
Application.ScreenUpdating = False
Worksheets("Paie FO").Visible = xlSheetVisible
Worksheets("Paie FO").Select
Application.ScreenUpdating = True
paieduformateur.Show
End With
End Sub