Bonjour
Modifies tes macros
'Pour le bouton Nouveau contact ================================================================================================
Private Sub CommandButton1_Click()
Dim L As Integer
If MsgBox("Confirmez-vous l’insertion de ce nouveau contact ?", vbYesNo, "Demande de confirmation d’ajout") = vbYes Then
L = Sheets("GROUPE").Range("a65536").End(xlUp).Row + 1 'Pour placer le nouvel enregistrement à la première ligne de tableau non vide
Range("A" & L).Value = ComboBox1
Range("B" & L).Value = ComboBox2
Range("C" & L).Value = TextBox1
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
Range("I" & L).Value = TextBox7.Value
End If
End Sub
'Pour le bouton Modifier ======================================================================================================
Private Sub CommandButton2_Click()
Dim Ligne As Long
Dim I As Integer
If MsgBox("Confirmez-vous la modification de ce contact ?", vbYesNo, "Demande de confirmation de modification") = vbYes Then
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = Me.ComboBox1.ListIndex + 2
Ws.Cells(Ligne, "B") = ComboBox2
For I = 1 To 7
If Me.Controls("TextBox" & I).Visible = True Then
Ws.Cells(Ligne, I + 2) = Me.Controls("TextBox" & I).Value
End If
Next I
End If
End Sub