1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Dim FichierTampon As Workbook
Dim Tableau As ListObjects
Dim DerLig As Long
Dim NOM As String, Prenom As String
Set FichierTampon = Workbooks.Open("E:\Planning-travail\Classeur2")
NOM = TextBox1
Prenom = TextBox5
'au moment de clique lebouton il se passe :
With FichierTampon
Set Tableau = ActiveWorkbook.Sheets(1).ListObjects("Tableau1")
With .Worksheets(1)
DerLig = .[A65536].End(xlUp).Offset(1, 1).Row
.Cells(DerLig, 1) = NOM & " " & Prenom
.Cells(DerLig, 2) = TextBox6.Value
.Cells(DerLig, 7) = Label6.Caption
.Cells(DerLig, 8) = TextBox2.Value
.Cells(DerLig, 9) = Label8.Caption
.Cells(DerLig, 10) = TextBox3.Value
If OptionButton1 Then
.Cells(DerLig, 5) = "J"
Else
.Cells(DerLig, 5) = "N"
End If
If OptionButton3 Then
.Cells(DerLig, 4) = "IDE"
Else
.Cells(DerLig, 4) = "ASD"
End If
If Chekbox1 Then
.Cells(DerLig, 6) = "dimanche"
ElseIf CheckBox2 Then
.Cells(DerLig, 6) = "férié"
ElseIf CheckBox1 = True And CheckBox2 = True Then
.Cells(DerLig, 6) = "Dimanche et férié"
Else
.Cells(DerLig, 6) = ""
End If
'.Tableau.Sort Key1:=Range("A1"), order1:=xlAscending
End With
.Save
.Close
End With
Unload Me 'vide et ferme l'USerForm
ActiveCell.Value = NOM 'la cellule active prend la valeur de NOM
End Sub |
Partager