XL 2013 Supprimer la dernière ligne selont le temps précédent

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Solution
Bonjour lestoiles1, le forum,
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim t
If Target.Column > 1 Or Target.Row = 1 Then Exit Sub
Application.EnableEvents = False
If Target(1) = "" Then
    Target(1, 2) = ""
Else
    t = Now
    If Target(1) = Target(0, 1) And _
        t < Application.Max(Columns(2)) + 3 / 86400 _
            Then Target.EntireRow.Delete Else Target(1, 2) = t
End If
Application.EnableEvents = True
End Sub
A+
Si vous voulez qu'entre 2 entrées il s'écoule au moins 3 secondes modifiez votre code :
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim t
If Target.Column > 1 Or Target.Row = 1 Then Exit Sub
Application.EnableEvents = False
If Target(1) = "" Then
    Target(1, 2) = ""
Else
    t = Now
    If t < Application.Max(Columns(2)) + 3 / 86400 Then Target.EntireRow.Delete Else Target(1, 2) = t
End If
Application.EnableEvents = True
End Sub
 
Dernière édition:
Si vous voulez qu'entre 2 entrées il s'écoule au moins 3 secondes modifiez votre code :
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim t
If Not Target.Address Like "$A$*" Or Target.Row = 1 Then Exit Sub
If Target(1) = "" Then
    Target(1, 2) = ""
Else
    t = Now
    If t < Application.Max(Columns(2)) + 3 / 86400 Then Target.EntireRow.Delete Else Target(1, 2) = t
End If
End Sub
C'est super, merci
 
Bonjour lestoiles1, le forum,
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim t
If Target.Column > 1 Or Target.Row = 1 Then Exit Sub
Application.EnableEvents = False
If Target(1) = "" Then
    Target(1, 2) = ""
Else
    t = Now
    If Target(1) = Target(0, 1) And _
        t < Application.Max(Columns(2)) + 3 / 86400 _
            Then Target.EntireRow.Delete Else Target(1, 2) = t
End If
Application.EnableEvents = True
End Sub
A+
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Question Question
Microsoft 365 Excel graphique
Réponses
1
Affichages
41
Réponses
10
Affichages
281
Réponses
1
Affichages
308
Retour