Bonjour
voila une modife
''Option Explicit
Dim Ws As Worksheet
Dim J As Long
Dim I As Long
Dim L As Long
'Pour le formulaire
Private Sub UserForm_Initialize()
Set Ws = Sheets(Feuil1.Name) 'Correspond au nom de votre onglet dans le fichier Excel
ComboBox1.Clear
For J = 2 To Ws.Range("A" & Rows.Count).End(xlUp).Row
ComboBox1.AddItem Ws.Range("A" & J)
Next
ComboBox2.Clear
ComboBox2.List() = Array("", "M.", "Mme", "Mlle")
For I = 1 To 6
Me.Controls("TextBox" & I).Visible = True
Next
End Sub
'Pour la liste déroulante Code client
Private Sub ComboBox1_Change()
Dim Ligne As Long
If ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = ComboBox1.ListIndex + 2
ComboBox2.Value = Ws.Cells(Ligne, "B")
For I = 1 To 6
Me.Controls("TextBox" & I) = Ws.Cells(Ligne, I + 2)
Next
End Sub
'Pour le bouton Nouveau contact
Private Sub CommandButton1_Click()
If MsgBox("Confirmez-vous l'insertion de ce nouvel Adhérent?", vbYesNo, "Demande de confirmation d 'ajout") = vbYes Then
With Ws
L = .Range("A" & Rows.Count).End(xlUp).Row + 1 'Pour placer le nouvel enregistrement à la première ligne de tableau non vide
I = Application.Max(Ws.Columns(1)) + 1
.Range("A" & L).Value = I
.Range("B" & L).Value = ComboBox2
.Range("C" & L).Value = TextBox1.Value
.Range("D" & L).Value = TextBox2.Value
.Range("E" & L).Value = TextBox3.Value
.Range("F" & L).Value = TextBox4.Value
.Range("G" & L).Value = TextBox5.Value
.Range("H" & L).Value = TextBox6.Value
End With
End If
End Sub
a toi de voir si ca te va
A+
Maurice