Re-bonsoir à tous.
Je souhaiterai pouvoir supprimer une ligne d'un objet tableau (et non pas la ligne entière) en fonction de la valeur d'une TextBox.
J'ai écris ce code, cependant la suppression ne se fait pas et je n'ai aucune erreur.
Private Sub CommandButton2_Click()
If TextBox1.value = "" Then
MsgBox ("Veuillez saisir un numéro de compte.")
Exit Sub
End If
With Sheets("Pcg")
r = MsgBox("confirmez-vous la suppression ?", vbYesNo, "Gestion des comptes")
If r <> 6 Then Exit Sub
For i = 2 To Range("B:B").End(xlDown).Row
If Me.TextBox1.Value = .Cells(i, 2) Then
.ListObjects("Plan_Comptable").ListRows(i).Delete
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
End If
Next i
Unload Me
USFPcg.show
End With
End Sub
Si vous pouvez trouver mon erreur ce serait sympa.
Cordialement.
Je souhaiterai pouvoir supprimer une ligne d'un objet tableau (et non pas la ligne entière) en fonction de la valeur d'une TextBox.
J'ai écris ce code, cependant la suppression ne se fait pas et je n'ai aucune erreur.
Private Sub CommandButton2_Click()
If TextBox1.value = "" Then
MsgBox ("Veuillez saisir un numéro de compte.")
Exit Sub
End If
With Sheets("Pcg")
r = MsgBox("confirmez-vous la suppression ?", vbYesNo, "Gestion des comptes")
If r <> 6 Then Exit Sub
For i = 2 To Range("B:B").End(xlDown).Row
If Me.TextBox1.Value = .Cells(i, 2) Then
.ListObjects("Plan_Comptable").ListRows(i).Delete
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
End If
Next i
Unload Me
USFPcg.show
End With
End Sub
Si vous pouvez trouver mon erreur ce serait sympa.
Cordialement.