Loop While Not C Is Nothing And C.Address <> firstAddress NE PASSE PAS
Bonjour à toutes et à tous,
J'ai récupéré ce code sur ce forum @mercatog mais la ligne Loop While Not C Is Nothing And C.Address <> firstAddress ne passe pas.
Une idée ?
Voici le code complet:
Code:
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
| Sub filter_by_name()
Dim MotCle
Dim NomFeuille
Dim i As Byte
Dim C As Range
Dim B As String
Dim Ligne As Integer
'On définit les mots clés
MotCle = Array("Alexios HARKIOLAKIS")
NomFeuille = Array("By names")
'On effectue la recherche de chaque mot clé dans la colonne W de la feuille 'Log'
For i = 0 To UBound(MotCle)
Do
Set C = Worksheets("Log").Columns(5).Find(MotCle(i), LookIn:=xlValues, LookAt:=xlPart)
'Si le mot clé est trouvé
If Not C Is Nothing Then
firstAddress = C.Address
'On définit le nom de la feuille où sera effectuée la copie
B = NomFeuille(i)
With Worksheets(B)
'On définit la ligne où sera effectué le collage
Ligne = .Range("E" & Rows.Count).End(xlUp).Row + 1
'On effectue le copier / coller
C.EntireRow.Copy .Range("A" & Ligne)
Set C = .FindNext(C)
End With
End If
Loop While Not C Is Nothing And C.Address <> firstAddress
Next i
End Sub |