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 45 46 47 48 49 50 51 52 53
| Option Explicit
Public Sub cherche_double_V2()
Dim dernl As Long
Dim t As Range, P As Range
Dim ladress As String
Dim c As Range
With Feuil1
dernl = .Cells(.Rows.Count, 5).End(xlUp).Row
With .Range("E1:E" & dernl)
Set t = .Find(What:="pa", Lookat:=xlPart)
If Not t Is Nothing Then
ladress = t.Address
Do
If P Is Nothing Then
Set P = t
Else
Set P = Union(P, t)
End If
Set t = .FindNext(t)
Loop While Not t Is Nothing And t.Address <> ladress
End If
End With
End With
Debug.Print P.Address
If Not P Is Nothing Then
With P
Set t = .Find(What:="mo", Lookat:=xlPart)
If Not t Is Nothing Then
ladress = t.Address
Do
Debug.Print t.Address
Set t = .FindNext(t)
Loop While Not t Is Nothing And t.Address <> ladress
End If
End With
End If
If Not t Is Nothing Then _
Set t = Nothing
If Not P Is Nothing Then _
Set P = Nothing
End Sub |
Partager