Private Sub cmdTest_Click()
Dim GTriTb, Chitiet As Variant, timsoxe As Range, i As Long
With Sheet3
GTriTb = .[a2].Resize(.[a60000].End(3).Row, 2)
End With
With Sheet4
Chitiet = .[a3].Resize(.[a60000].End(3).Row, 13)
End With
ReDim kq(1 To UBound(GTriTb), 1 To 5)
For i = 1 To UBound(GTriTb)
If GTriTb(i, 1) <> "" And GTriTb(i, 2) <> "" Then
Set timsoxe = Sheet4.[f:f].Find(GTriTb(i, 1), , , xlValue)
If Not timsoxe Is Nothing Then
k = timsoxe.Row - 2 + Val(Left(GTriTb(i, 2), 1) = "T")
kq(i, 1) = GTriTb(i, 2)
kq(i, 2) = Chitiet(k, 2)
kq(i, 3) = Chitiet(k, 10)
kq(i, 4) = Chitiet(k, 4)
kq(i, 5) = Chitiet(k, 5)
End If
End If
Next
[e2].Resize(i, 5) = kq
End Sub