Private Sub OptionButtonpositif_Click()
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then Cancel = True ' fermeture par la croix impossible
End Sub
Sub Selectionfeuille(ByVal N As Integer) ' rajouter pour ma listbox coef
Select Case N
Case 0
TextBox3.Text = "2"
Case 1
TextBox3.Text = "1"
Case 2
TextBox3.Text = "2"
Case 3
TextBox3.Text = "2"
Case 4
TextBox3.Text = "1"
Case 5
TextBox3.Text = "1"
Case 6
TextBox3.Text = "2"
End Select
End Sub
Private Sub actualiseruserform2_Click()
Unload UserForm2
UserForm2.Show
End Sub
Private Sub Commandeffacer_Click() ' efface une ligne de l'agent
On Error GoTo erreur
If TextBox1 = " " Then
MsgBox ("Merci d'indiquer une ligne")
End If
If MsgBox("Etes vous sûr de supprimer cette ligne?", vbYesNo) = vbYes Then Rows(Val(TextBox6)).Delete
Unload UserForm2 ' mise a jour userform
UserForm2.Show
Exit Sub
erreur:
MsgBox ("Il faut indiquer un nombre pour une ligne.")
End Sub
Sub initialise() 'remet à zéro l'UF
Unload UserForm1
UserForm1.Show
End Sub
Private Sub Commandsuprimer_Click() 'suprime feuille selectionner dans la liste
Dim WS As Worksheet
Set WS = Worksheets(ListBox1.Value)
WS.Delete
Unload UserForm2
UserForm2.Show
End Sub
Private Sub creerfeuillebox_Click() ' appelle le module
ajout_clients2
End Sub
Private Sub Combobox2_Click() 'pour le coef
Dim N As Integer
N = Me.ComboBox2.ListIndex
Call Selectionfeuille(N)
End Sub
Private Sub impression_Click()
Unload UserForm2
ActiveSheet.PageSetup.PrintArea = "a2:j37"
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.78740157480315)
.RightMargin = Application.InchesToPoints(0.78740157480315)
.TopMargin = Application.InchesToPoints(0.984251968503937)
.BottomMargin = Application.InchesToPoints(0.984251968503937)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.511811023622047)
.PrintHeadings = False
.PrintGridlines = False
.CenterHorizontally = False
.CenterVertically = False
.PaperSize = xlPaperA4
End With
ActiveWindow.SelectedSheets.PrintPreview
ActiveWindow.SelectedSheets.PrintOut Copies:=1
UserForm2.Show
End Sub
Private Sub TextBox1_Change() ' m'est au format date textbox1
Dim Val As Byte
TextBox1.MaxLength = 10 'nb caractères maxi autorisé dans le textbox
Val = Len(TextBox1)
If Val = 2 Or Val = 5 Then TextBox1 = TextBox1 & "/"
End Sub
Private Sub UserForm_Initialize() ' pour le coef
ComboBox2.Clear
ComboBox2.AddItem "Dimanche" 'rajout des additem pour liste non automatique coéf
ComboBox2.AddItem "Horaire normal"
ComboBox2.AddItem "Jours Férié"
ComboBox2.AddItem "Nuit"
ComboBox2.AddItem "Récupération"
ComboBox2.AddItem "Service Ordre normal"
ComboBox2.AddItem "Service Ordre renfort"
Dim WS As Worksheet ' code donner par hulk cacher feuille original( merci hulk)
ListBox1.Clear
For Each WS In Worksheets
If WS.Name <> ("original") Then ListBox1.AddItem WS.Name
Next
End Sub
Private Sub ListBox1_Click() 'liste agent suite du code par hulk
Sheets(ListBox1.Value).Activate
Me.TextBox5.Value = ActiveSheet.Range("j3").Value ' copie ma celulle résultat dans ma textbox
Me.TextBox7.Value = ActiveSheet.Name ' ecris le nom de la feuille textbox
End Sub
Private Sub CommandButton1_Click() ' valider mes optionbouton
If Not (OptionButton1 Or OptionButton2) Then
MsgBox "Vous devez indiquer si les heures sont à ajouter ou à déduire !", vbExclamation, _
"ERREUR ...!"
OptionButton1.SetFocus
Exit Sub
End If
Selection.Insert Shift:=xlDown ' copie la ligne 10 sur la ligne 9
Rows("9:9").Select
Selection.Copy
Rows("10:10").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("a9") = CDate(TextBox1.Value) ' TextBox1.Value ' CDate(TextBox1.Value)par le userform ecrie dans la cellule format date
Range("b9") = TextBox2.Value ' heure saisir
Range("c9") = ComboBox2.Value ' saisie liste dimanche etc.
Range("d9") = TextBox3.Value ' affiche coef automatique grace combobox2
Range("e9") = TextBox4.Value ' saisie texte motif heure
TextBox1.Text = ""
TextBox3.Text = ""
TextBox2.Text = ""
TextBox4.Text = ""
TextBox7.Text = ""
'Range("a9").NumberFormat = "d/m/yy"
If OptionButton1.Value = True Then 'c est la que j ai un problème
' rien mettre
End If
If OptionButton2.Value = True Then 'condition : si le bouton d'option 2 est coché je veut que sa me fasse une soutraction comme si j incris -10 a la place de 10 dans textbox2
'mettre le code pour
End If
Unload UserForm2
UserForm2.Show
End Sub
Private Sub quitter_Click()
Excel.Application.Visible = True
End
End Sub
Private Sub retouruserform1_Click()
ActiveWorkbook.Save
Excel.Application.Visible = False
Unload UserForm2
UserForm1.Show
End Sub