Marco Excel

Résolu
Whyn -  
michel_m Messages postés 18903 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour,

Alors voila mon problème. Je voudrais faire une macro, qui Supprimerai une ligne dans la colonne "TEST" si il y a marqué "Erreur de test." dans celle si.

Exemple

col1 col2 test col3

x x x x
x x x x
x x x x
x x Erreur de test x

Dans ce cas la, la macro supprime la ligne 4 entièrement..

Si vous pouviez m'aider.
merci d'avance !

1 réponse

  1. michel_m Messages postés 18903 Date d'inscription   Statut Contributeur Dernière intervention   3 320
     
    Bonjour

    Option Explicit
    '---------
    Sub supprimer_ligne_si()
    Dim Nbre As Integer, Lig As Integer, cptr As Integer
    Application.ScreenUpdating = False
    Nbre = Application.CountIf(Columns(3), "erreur de test")
    If Nbre > 0 Then
    Lig = 1
    For cptr = 1 To Nbre
    Lig = Columns(3).Find("erreur de test", Range("C1"), , xlWhole).Row
    Rows(Lig).Delete
    Next
    End If
    End Sub

    0