J'ai un souci avec ma macro. Je souhaite supprimer toutes les lignes dont la colonne A ne contient pas le mot "MATCHING". Et ça ne le fait pas...
Code:
Const st As String = "MATCHING"
Dim c As Range, f As Long
f = Cells.SpecialCells(xlCellTypeLastCell).Row
For Each c In Range("a1:a" & f)
If c <> st Then
c.EntireRow.Delete
End If
Next
Re : Macro de suppression de ligne si condition non vérifiée
Je code pas avec cell ... mais bon j'aurai rajouté un .value ...
Code:
Const st As String = "MATCHING"
Dim c As Range, f As Long
f = Cells.SpecialCells(xlCellTypeLastCell).Row
For Each c In Range("a1:a" & f)
If c[COLOR="Red"].value[/COLOR] <> st Then
c.EntireRow.Delete
End If
Next
Re : Macro de suppression de ligne si condition non vérifiée
Merci pour ta réponse phestaca. Comme ça ne marchait toujours pas, en me baladant sur le net, j'ai trouvé une autre formule qui marche :
Code:
Dim I As Long
Dim Plage As Range
Set Plage = Range("A2:A" & Range("A2").End(xlDown).Row)
For I = Plage.Cells.Count To 1 Step -1
If Plage.Cells(I).Value <> "MATCHING" Then
Plage.Cells(I).EntireRow.Delete
End If
Next