Bonjour à tous.
J'utilise le code suivant pour valider ma saisie. Le problème je voudrais qu'à travers le choix dans le premier contrôle (ComboBox1) les autres soient rechargés par les valeurs déjà saisies pour que je puisse modifier. Je demande votre aide pour pour modifier le code. Merci d'avance.
code.
Private Sub CommandButton4_Click()
'--- Contrôles
If Me.ComboBox1 = "" Then
MsgBox "Saisir un numéro matricule !"
Me.ComboBox1.SetFocus
Exit Sub
End If
If Me.ComboBox2 = "" Then
MsgBox "Choisir le sexe de l'élève !"
Me.ComboBox2.SetFocus
Exit Sub
End If
If Me.TextBox1 = "" Then
MsgBox "Saisir le nom de l'élève !"
Me.TextBox1.SetFocus
Exit Sub
End If
If Me.TextBox2 = "" Then
MsgBox "Saisir le prénom de l'élève !"
Me.TextBox2.SetFocus
Exit Sub
End If
'--- Positionnement dans la base
ligne = Sheets("identite").[A65000].End(xlUp).Row + 1
'--- Transfert Formulaire dans identite
Sheets("identite").Cells(ligne, 1) = Application.Proper(Me.ComboBox1)
Sheets("identite").Cells(ligne, 2) = Me.ComboBox2
Sheets("identite").Cells(ligne, 3) = Me.TextBox1
Sheets("identite").Cells(ligne, 4) = Me.TextBox2
Sheets("identite").Cells(ligne, 5) = Me.TextBox3
Sheets("identite").Cells(ligne, 6) = Me.TextBox4
Sheets("identite").Cells(ligne, 7) = Me.TextBox5
Sheets("identite").Cells(ligne, 8) = Me.TextBox6
Sheets("identite").Cells(ligne, 9) = Me.TextBox7
Sheets("identite").Cells(ligne, 10) = Me.TextBox8
Sheets("identite").Cells(ligne, 11) = Me.TextBox9
Dim c As Control
For Each c In Me.Controls
Select Case TypeName(c)
Case "TextBox"
c.Value = ""
Case "ComboBox"
c.Value = ""
End Select
Next c
End Sub