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 57 58 59 60 61 62 63 64 65 66 67 68
| Private Sub CommandButton1_Click()
'Ajouter une nouvelle feuille au nom du salarié
With Sheets.Add
.Name = ComboBox1.Value
End With
'création du tableau
Sheets("Base").Range("P1:AW14").Copy Sheets(ComboBox1.Value).Range("A1")
Columns("B:AF").Select
Selection.ColumnWidth = 2.63
'intégration des données du salarié dans le planning
Range("b1") = "Planning annuel : " & ComboBox1.Value
Range("A2") = ComboBox2.Value
If ComboBox3.Value = "Janvier" Then
Range("A3") = ComboBox3.Value
ElseIf ComboBox3.Value = "Février" Then
Range("A4") = ComboBox3.Value
ElseIf ComboBox3.Value = "Mars" Then
Range("A5") = ComboBox3.Value
ElseIf ComboBox3.Value = "Avril" Then
Range("A6") = ComboBox3.Value
ElseIf ComboBox3.Value = "Mai" Then
Range("A7") = ComboBox3.Value
ElseIf ComboBox3.Value = "Juin" Then
Range("A8") = ComboBox3.Value
ElseIf ComboBox3.Value = "Juillet" Then
Range("A9") = ComboBox3.Value
ElseIf ComboBox3.Value = "Août" Then
Range("A10") = ComboBox3.Value
ElseIf ComboBox3.Value = "Septembre" Then
Range("A11") = ComboBox3.Value
ElseIf ComboBox3.Value = "Octobre" Then
Range("A12") = ComboBox3.Value
ElseIf ComboBox3.Value = "Novembre" Then
Range("A13") = ComboBox3.Value
ElseIf ComboBox3.Value = "Décembre" Then
Range("A14") = ComboBox3.Value
Else
Range("A14") = ""
End If
no_ligne = Sheets("Base").Range("K65536").End(xlUp).Row + 1
Sheets("Base").Cells(no_ligne, 11) = ComboBox1.Value
Unload Me
Range("A1").Select
'AjoutCommandButton_Feuille()
Dim Obj As OLEObject
'Ajout CommandButton dans la feuille
Set Obj = Sheets(ComboBox1.Value).OLEObjects.Add("Forms.CommandButton.1")
With Obj
.Left = 616 'position horizontale
.Top = 230 'position verticale
.Width = 140 'largeur
.Height = 30 'hauteur
.Object.BackColor = RGB(235, 235, 200) 'Couleur de fond
.Object.Caption = "Fermer le planning"
End With
End Sub |
Partager