1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| Sub ioi()
Dim Tabl As ListObject
Dim CellRech As Range
Dim Repere As String
Dim Continuer As Boolean
Application.ScreenUpdating = False
With Feuil1
' création du ListObject
Set Tabl = .ListObjects.Add(xlSrcRange, .Cells(1, 2).CurrentRegion, , xlYes)
' on cherche la première occurence "terminé"
Set CellRech = Tabl.Range.Columns(2).Find("terminé", .Cells(1, 3), xlValues, xlWhole)
' s'il y en a une
If Not CellRech Is Nothing Then
' on stock l'adresse du résultat
Repere = CellRech.Address
' on supprime la ligne
CellRech.EntireRow.Delete
' on met un drapeau pour faire une boucle de recherche
Continuer = True
While Continuer = True
' recherche des occurences suivantes
Set CellRech = Tabl.Range.Columns(2).Find("terminé", .Range(Repere).Offset(-1, 0), xlValues, xlWhole)
If Not CellRech Is Nothing Then
Repere = CellRech.Address
CellRech.EntireRow.Delete
Else
' permet de s'arrêter quand il n'y a plus de résultat
Continuer = False
End If
Wend
End If
End With
Application.ScreenUpdating = True
End Sub |
Partager