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 44
| Private Sub CommandButton1_Click()
Const PremLig = 1
Dim TabMotsCles
Dim W As String
W = "A"
Dim s As String
Dim E As String
Dim Lig As Long, DerLig As Long, NumMot As Long, NbMots As Long
Dim trouve As Boolean
' initalisations
STEP1:
TabMotsCles = Array("IMPACT", "RENDEMENT")
NbMots = UBound(TabMotsCles, 1)
With Sheets(1)
' dernière ligne
While W <> "Z"
DerLig = .Range(W & 1).End(xlUp).Row
' traitement de la colonne colcritere
For Lig = DerLig To PremLig Step -1
' met en majuscule la cellule
s = UCase(.Range(W & Lig))
trouve = False
' recherche d'un mot cle dans s
For NumMot = 1 To NbMots
If InStr(1, s, TabMotsCles(NumMot)) > 0 Then
trouve = True
End If
Next NumMot
' si trouve mot cle supprimer la ligne lig
If trouve Then
Columns(W).Delete Shift:=xlToLeft
End If
Next Lig
E = Asc(W)
E = E + 1
W = Chr(E)
Wend
End With
End If
End Sub |
Partager