Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

problèmes de fonctionnement d'un userform

  • Initiateur de la discussion Mathou
  • Date de début
M

Mathou

Guest
Bonjour à tous,
Je souhaiterai que les textbox d'un userform se remplissent automatiquement à partir du moment ou l'on a sélectionné une donnée dans une combobox. J'ai tappé le code suivant mais ça ne fonctionne pas Quelqu'un peux t'il m'aider?
Merci
Private Sub UserForm_Initialize()

Dim Plage As Range

With Worksheets('FeuilPersonnel')
Set Personnel1 = .Range('B2')
Set Plage = .Range(Personnel1, .Range('B65536').End(xlUp))
Set Tableau1 = Plage.Resize(, 50)
End With

ComboBoxNOM.List = Plage.Value

End Sub

Private Sub ComboBoxNOM_Change()
Dim Lgn&
Dim Célibataire, Marié, PACSE, Divorcé As String

Lgn = ComboBoxNOM.ListIndex + 1
With Tableau1
TextDate.Value = Cells(Lgn, 1)
TextPrénom.Value = Cells(Lgn, 3)
TextAdresse1.Value = Cells(Lgn, 4)
TextAdresse2.Value = Cells(Lgn, 5)
TextCodePostal.Value = Cells(Lgn, 6)
TextVille.Value = Cells(Lgn, 7)
TextFixe.Value = Cells(Lgn, 8)
TextPortable.Value = Cells(Lgn, 9)
TextEmail.Value = Cells(Lgn, 10)
TextNiveau_scolaire1.Value = Cells(Lgn, 11)
TextNiveau_scolaire2.Value = Cells(Lgn, 12)
TextNSécu.Value = Cells(Lgn, 13)
ComboBoxGS.Value = Cells(Lgn, 14)
TextRenseignements_complémentaires.Value = Cells(Lgn, 15)
ComboBoxGrade.Value = Cells(Lgn, 16)
TextBox1.Value = Cells(Lgn, 17)
TextBox2.Value = Cells(Lgn, 18)
TextBox3.Value = Cells(Lgn, 19)
TextN_AFPS.Value = Cells(Lgn, 20)
TextBox6.Value = Cells(Lgn, 21)
TextN_CFAPSE.Value = Cells(Lgn, 22)
TextBox5.Value = Cells(Lgn, 23)
TextN_CFAPSR.Value = Cells(Lgn, 24)
TextBox4.Value = Cells(Lgn, 25)
TextCOD.Value = Cells(Lgn, 26)
TextFDF.Value = Cells(Lgn, 27)
TextRCH.Value = Cells(Lgn, 28)
TextRAD.Value = Cells(Lgn, 29)
TextSAV.Value = Cells(Lgn, 30)
TextSAL.Value = Cells(Lgn, 31)
TextIMP.Value = Cells(Lgn, 32)
TextISS.Value = Cells(Lgn, 33)
TextEPS.Value = Cells(Lgn, 34)
TextPRV.Value = Cells(Lgn, 35)
TextPRS.Value = Cells(Lgn, 36)
TextFOR.Value = Cells(Lgn, 37)
TextCAN.Value = Cells(Lgn, 38)
TextCYN.Value = Cells(Lgn, 39)
TextSDE.Value = Cells(Lgn, 40)
TextSMO.Value = Cells(Lgn, 41)
TextTRS.Value = Cells(Lgn, 42)
TextN_Permis_PL.Value = Cells(Lgn, 43)
TextBox7.Value = Cells(Lgn, 44)
'statut = Cells(Lgn, 45)
'situation = Cells(Lgn, 46)
'permis = Cells(Lgn, 47)
'fonction = Cells(Lgn, 48)
'permis_poids_lourds = Cells(Lgn, 49)


If Cells(Lgn, 46).Value = 'Célibataire' Then
OptionButton1 = True
OptionButton2 = False
OptionButton3 = False
OptionButton4 = False
Else
End If
If Cells(Lgn, 46).Value = 'Marié' Then
OptionButton1 = False
OptionButton2 = True
OptionButton3 = False
OptionButton4 = False
Else
End If
If Cells(Lgn, 46).Value = 'PACSE' Then
OptionButton1 = False
OptionButton2 = False
OptionButton3 = True
OptionButton4 = False
Else
End If
If Cells(Lgn, 46).Value = 'Divorcé' Then
OptionButton1 = False
OptionButton2 = False
OptionButton3 = False
OptionButton4 = True

End If

End With

End Sub

 
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…