Re : Macro et les cases à cocher
Bonjour
j'ai un souci avec mes boutons d'options
7 boutons A -R-P -AP-AR-DP-DR.
Cela fonctionne et les reponses vont bien dans ma textebox4 toutefois quand j'ai clique par exemple sur P et que j'appellepar ma liste deroulante un autre nom sur la combox2 , le bouton reste sur la dernier choix.
Je voudrais que quand j'ai cliqué sur P ou R , l'option bouton soit de nouveau sur A pour le prochain choix.
De même je cherche que le nom du mandataire que j'inscris dans la combox 2 , s'efface pour le choix suivant.
ci aprés :
Private Sub absent_Click()
P_ou_A = IIf(AB, "P", "A") 'si le bouton est coché => a sinon p
TextBox3 = P_ou_A: ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 10) = P_ou_A
End Sub
Private Sub AP_Click()
AR_ou_AP = IIf(AB, "AR", "AP") 'si le bouton est coché => P sinon A
TextBox3 = AR_ou_AP: ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 10) = AR_ou_AP
End Sub
Private Sub AR_Click()
AP_ou_AR = IIf(AB, "AP", "AR") 'si le bouton est coché => P sinon A
TextBox3 = AP_ou_AR: ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 10) = AP_ou_AR
End Sub
Private Sub DP_Click()
DR_ou_DP = IIf(AB, "DR", "DP") 'si le bouton est coché => P sinon A
TextBox3 = DR_ou_DP: ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 10) = DR_ou_DP
End Sub
Private Sub DR_Click()
DP_ou_DR = IIf(AB, "DP", "DR") 'si le bouton est coché => P sinon A
TextBox3 = DP_ou_DR: ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 10) = DP_ou_DR
End Sub
Private Sub present_Click()
A_ou_P = IIf(AB, "A", "P") 'si le bouton est coché => P sinon A
TextBox3 = A_ou_P: ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 10) = A_ou_P
End Sub
Private Sub REPRESENTE_Click()
P_ou_R = IIf(AB, "P", "R") 'si le bouton est coché => R sinon A
TextBox3 = P_ou_R: ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 10) = P_ou_R
End Sub
Private Sub TextBox3_Change()
Sheets("emargement").Select
ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 10).Value = Me.TextBox3.Value
End Sub
Private Sub TextBox4_change()
Sheets("emargement").Select
ActiveWorkbook.ActiveSheet.Cells(Me.ComboBox2.ListIndex + 16, 9).Value = Me.TextBox4.Value
'Sheets("emargement").TextBox4.Text = ""
'textBox4.Text = "";
'textBox4.GotFocus -= TextBox1_GotFocus;
Application.ScreenUpdating = True ' Code à placer en fin de macro
End Sub
Private Sub userform_Initialize()
Dim Cell As Range
With Sheets("emargement")
For Each Cell In .Range("C16:C" & .Range("C65536").End(xlUp).Row)
Me.ComboBox2.AddItem (Cell & " " & Cell.Offset(0, 1))
Next
End With
End Sub
Private Sub TextBox4_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
TextBox4 = ""
End Sub
Private Sub TextBox3_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal Y As Single)
TextBox3 = ""
Merci d'avance.
Jean BOUCHET