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
| Sub Resultat()
Dim f1 As Worksheet, f2 As Worksheet, f3 As Worksheet
Dim DerLig_f1 As Long, DerLig_f2 As Long, DerLig_f3 As Long, n As Long
Dim c As Long, i As Long, j As Long
Dim Dep As String
Deb = Timer
Application.ScreenUpdating = False
Set f1 = Sheets("Comparaison")
Set f2 = Sheets("Liste")
Set f3 = Sheets("Resultat")
f3.Cells.ClearContents
DerLig_f1 = f1.Range("A" & Rows.Count).End(xlUp).Row
DerLig_f2 = f2.Range("A" & Rows.Count).End(xlUp).Row
For c = 1 To 2
ReDim tabl(60000) As String
n = 1
DerLig_f3 = 2
For i = 2 To DerLig_f1
P = f1.Cells(i, c)
With f2.Range(f2.Cells(1, "A"), f2.Cells(DerLig_f2, "A"))
Set x = .Find(P, lookat:=xlWhole)
If Not x Is Nothing Then
Dep = x.Address
Do
tabl(n) = f2.Cells(x.Row, "B") & "-" & x
n = n + 1
DerLig_f3 = DerLig_f3 + 1
Set x = .FindNext(x)
Loop While Not x Is Nothing And x.Address <> Dep
End If
End With
Next i
f3.Range(f3.Cells(1, c), f3.Cells(DerLig_f3 - 1, c)) = Application.WorksheetFunction.Transpose(tabl)
Erase tabl()
Next c
f3.Range("A1:B1") = Array("TxP1", "TxP2")
MsgBox "Durée: " & Timer - Deb & "Sec"
Set x = Nothing
Set f1 = Nothing
Set f2 = Nothing
Set f3 = Nothing
End Sub |
Partager