Sub Test()
Dim Row As Range, Target As Range, To_Del as String
Set Target = Range("A1:E20") ' <-- range bidon à modifier
For Each Row In Target.Rows
Select Case True
Case Not SFW(Row, "rich")
Case Not SFW(Row, "precious alloy")
' Case Not SFW(Row, "any") <-- pour des restrictions supplémentaires
Case To_Del = "": To_Del = Row.Row & ":" & Row.Row
Case Else: To_Del = To_Del & "," & Row.Row & ":" & Row.Row
End Select
Next
If To_Del <> "" Then
Range(To_Del).Select
If MsgBox("Voulez-vous détruire les lignes sélectionnées ?", vbCritical + vbYesNo) = vbYes Then
Selection.Delete
End If
End If
Cells(1).Activate
End Sub
Function SFW(Plage As Range, W As String) As Boolean
Dim Cell_Sel As Range
Set Cell_Sel = Plage.Find(W, , xlFormulas, xlPart, xlByColumns, xlNext, False)
If Not Cell_Sel Is Nothing Then
If Len(Trim(Cell_Sel)) <> Len(W) Then Set Cell_Sel = Nothing
End If
SFW = Not Cell_Sel Is Nothing
End Function