Sprawdź czy o to chodzi
Sub sprawdź()
Dim i As Long, j As Long, komorka As Range
With Sheets("Arkusz2")
For i = 2 To Sheets("Arkusz1").Cells(Rows.Count, 1).End(xlUp).Row
Set komorka = Sheets("Arkusz1").Cells(i, 1)
For j = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
If .Cells(j, 1) = komorka Then
If komorka.Offset(0, 4) = "" Then
Sheets("Arkusz1").Cells(i, 5) = .Cells(j, 2)
Sheets("Arkusz1").Rows(i).Interior.Color = vbRed
End If
End If
Next j
Next i
End With
End Sub |