Bonjour,
J'ai essayé de travailler sur ce code (trouvé sur un exemple du forum).
Tout fonctionne sauf la modification (le plus important).
Si quelqu'un a une autre idée.
Private Sub CommandButton1_Click()
Dim Modif, Rep
Set Modif = Sheets("BDD").Range("B:B").Find(ComboBox1.Value, LookIn:=xlValues, lookat:=xlWhole)
If Modif Is Nothing Then
maligne = Sheets("BDD").Range("B65536").End(xlUp).Row + 1
Else
Rep = MsgBox("Le matricule N° " & ComboBox1.Value & " existe !" & vbCrLf & "Voulez-vous la remplacer ?")
If Rep = vbCancel Then Exit Sub
maligne = Modif.Row
End If
For Each ctl In Me.Controls
If Not ctl.Tag = "" Then
Sheets("BDD").Range(ctl.Tag & maligne) = ctl.Value
ctl.Value = ""
End If
Next
Unload Me
End Sub
Private Sub ComboBox1_Change()
Dim Lg As Long
Lg = ComboBox1.ListIndex + 2
For Each ctl In Me.Controls
If ctl.Tag > "B" Then
ctl.Value = Feuil1.Range(ctl.Tag & Lg)
End If
Next
End Sub