Suppression d'une ligne valider
roudiroud
Messages postés
36
Statut
Membre
-
roudiroud Messages postés 36 Statut Membre -
roudiroud Messages postés 36 Statut Membre -
Bonjour,
je souheterai supprimer une ligne apprès sa validation par l'utilisateur
j'ai un code pour la validation qui resemble à ca :
Private Sub ButValide_Click()
Dim L As Long
Dim C As Long
If MsgBox("Etes-vous certain de vouloir insérer ce nouveau client ?", vbYesNo, "Demande de confirmation") = vbYes Then
With Feuil3
L = .Range("A" & Rows.Count).End(xlUp).Row + 1
For C = 1 To 13
.Cells(L, C).Value = Controls("TextBox" & C).Value
Next
.Cells(L, 2).Value = DateValue(TextBox2.Value)
.Cells(L, 3).Value = DateValue(TextBox3.Value)
End With
End If
MsgBox ("Client inséré dans fichier sélectionné")
'Unload Me 'Ferme le formulaire
End Sub
je souheterai ajouté une supréssion en plus, j'ai essayer en mettant ce code mais rien ne ce passe
Rows(Selection.Row).Delete shift:=xlUp
Merci :)
je souheterai supprimer une ligne apprès sa validation par l'utilisateur
j'ai un code pour la validation qui resemble à ca :
Private Sub ButValide_Click()
Dim L As Long
Dim C As Long
If MsgBox("Etes-vous certain de vouloir insérer ce nouveau client ?", vbYesNo, "Demande de confirmation") = vbYes Then
With Feuil3
L = .Range("A" & Rows.Count).End(xlUp).Row + 1
For C = 1 To 13
.Cells(L, C).Value = Controls("TextBox" & C).Value
Next
.Cells(L, 2).Value = DateValue(TextBox2.Value)
.Cells(L, 3).Value = DateValue(TextBox3.Value)
End With
End If
MsgBox ("Client inséré dans fichier sélectionné")
'Unload Me 'Ferme le formulaire
End Sub
je souheterai ajouté une supréssion en plus, j'ai essayer en mettant ce code mais rien ne ce passe
Rows(Selection.Row).Delete shift:=xlUp
Merci :)
2 réponses
-
Bonjour,
Essaies ce code :Private Sub ButValide_Click() Dim L As Long Dim C As Long Dim R As Range If MsgBox("Etes-vous certain de vouloir insérer ce nouveau client ?", vbYesNo, "Demande de confirmation") = vbYes Then With Feuil3 L = .Range("A" & Rows.Count).End(xlUp).Row + 1 For C = 1 To 13 .Cells(L, C).Value = Controls("TextBox" & C).Value Next .Cells(L, 2).Value = DateValue(TextBox2.Value) .Cells(L, 3).Value = DateValue(TextBox3.Value) End With With Feuil1 Set R = .Columns("A").Find(TextBox1.Value, , xlValues, xlWhole) If Not R Is Nothing Then R.EntireRow.Delete ComboBox1.Clear For L = 2 To .Range("A" & Rows.Count).End(xlUp).Row ComboBox1.AddItem .Range("A" & L) Next End With MsgBox ("Client inséré dans fichier sélectionné") End If End Sub-
Merci pour ton aide, mais j'ai finalement reussi avec ce code :
Private Sub ButValide_Click()
Dim L As Long
Dim C As Long
Dim Ligne As Long
If MsgBox("Etes-vous certain de vouloir insérer ce nouveau client ?", vbYesNo, "Demande de confirmation") = vbYes Then
With Feuil3
L = .Range("A" & Rows.Count).End(xlUp).Row + 1
For C = 1 To 13
.Cells(L, C).Value = Controls("TextBox" & C).Value
Next
.Cells(L, 2).Value = DateValue(TextBox2.Value)
.Cells(L, 3).Value = DateValue(TextBox3.Value)
End With
If ComboBox1.ListIndex = -1 Then Exit Sub
If MsgBox("Etes-vous certain de vouloir suprimer client ?", vbYesNo, "Demande de confirmation") = vbYes Then
Ligne = ComboBox1.ListIndex + 2
Feuil1.Rows(Ligne).Delete
End If
End If
MsgBox ("Client inséré dans fichier sélectionné") 'Vous informe que le client a été ajouté dans le tableau Excel
'Unload Me 'Ferme le formulaire
End Sub
MERCI ENCORE
a+
-
-
Bonjour
Tu veux supprimer quoi et où ?