Private Sub Cmdok_Click()
For Each ctrl In Controls
If TypeName(ctrl) = "TextBox" Then
If ctrl = "" Then
MsgBox "vous devez renseigner : " & Right(ctrl.Name, Len(ctrl.Name) - 3)
ctrl.SetFocus
Exit Sub
End If
End If
Next
For Each ctrl In Controls
If TypeName(ctrl) = "OptionButton" Then
If ctrl And ctrl.GroupName = "Groupgrades" Then
Grades = ctrl.Caption
Exit For
End If
End If
Next
If Grades = "" Then
MsgBox "veuillez renseigner le grade": Exit Sub
End If
For Each ctrl In Controls
If TypeName(ctrl) = "OptionButton" Then
If ctrl And ctrl.GroupName = "qualifications" Then
Qualif = ctrl.Caption
Exit For
End If
End If
Next
If Qualif = "" Then
MsgBox "Veuillez renseigner la qualification": Exit Sub
End If
' Conversion du nom et prénom en NOMPRPRE qualifications
Nomconverti = Application.WorksheetFunction.Proper(Me.txtnom.Text)
Prenomconverti = Application.WorksheetFunction.Proper(Me.txtprenom.Text)
' Mise en place des valeurs saisies
derlig = [A65000].End(xlUp).Row + 1
Cells(derlig, 1) = Nomconverti
Cells(derlig, 2) = Prenomconverti
Cells(derlig, 3) = Grades
Cells(derlig, 4) = txtmatricule
Cells(derlig, 5) = txtadresse
Cells(derlig, 6) = txtcodepostal
Cells(derlig, 7) = txtville
Cells(derlig, 8) = txttelephone
Cells(derlig, 9) = Qualif
' On décharge le formulaire
Unload Me
End Sub