Sub test()
Dim a As Variant, lr, i, x, s, k, itm
a = Sheets(1).Range("B2:B" & Sheets(1).Cells(Rows.Count, 2).End(xlUp).Row).Resize(, 7)
With CreateObject("scripting.dictionary")
For i = 1 To UBound(a)
If a(i, 1) <> 0 Then
If Not .exists(a(i, 1)) Then If a(i, 7) = Sheets(2).Range("C1") Then .Add a(i, 1), a(i, 7)
End If
Next
Sheets(2).Cells(10, 1).Resize(.Count, 2) = Application.Transpose(Application.Index(Array(.keys, .items), 0, 0))
End With
End Sub
أو
Sub test()
Dim a As Variant, lr, i, x, s, k, itm
a = Sheets(1).Range("B2:B" & Sheets(1).Cells(Rows.Count, 2).End(xlUp).Row).Resize(, 7)
With CreateObject("scripting.dictionary")
For i = 1 To UBound(a)
If a(i, 1) <> 0 Then
If Not .exists(a(i, 1)) Then If a(i, 7) = Sheets(2).Range("C1") Then .Add a(i, 1), ""
End If
Next
Sheets(2).Cells(10, 1).Resize(.Count) = Application.Transpose(.keys)
End With
End Sub