Supprimer toutes les lignes après un mot particulier

Bonjour

j'aimerais pouvoir supprimer toutes les lignes se trouvant après un mot particulier !

je suis bloqué !

Ici ca marche juste pour la ligne en question... je voudrais que toutes les lignes suivantes jusqu'à la fin de la feuille soit supprimé !

Dim a As Long

Dim b As Long

a = Range("A65536").End(xlUp).Row

For b = a To 1 Step -1

If Cells(b, 1).Value = "tonmot" Then

Rows(b).Delete

End If

Next b

Bonjour,

Sub Test()
Dim DerCel As Range, C As Range
    Set DerCel = Range("A" & Rows.Count).End(xlUp)
    Set C = Range("A1", DerCel).Find("tonmot", , xlValues, xlWhole).Offset(1)
    If Not C Is Nothing Then
        Range(C, DerCel).EntireRow.Delete
    End If
End Sub

A+

Bonjour tout le monde,

comme ceci eventuellement

sub supp_ligne
Dim a As Long
Dim b As Long

a = Range("A65536").End(xlUp).Row

For b = a To 1 Step -1

If Cells(b, 1).Value = "tonmot" Then

Rows(b + 1 & ":" & a).Delete

End If

Next b
end sub

Cordialement

ok merci bcp !

Rechercher des sujets similaires à "supprimer toutes lignes mot particulier"