答案 0 :(得分:0)
可以尝试以下,
Sub test()
i = 2
With ActiveSheet
For Each Cell In .Range("B2:" & .Range("B2").End(xlDown).Address)
If Cell.Row + 1 < .Range("B2").End(xlDown).Row Then
For Each C In .Range(.Cells(Cell.Row + 1, 2).Address, .Range("B2").End(xlDown).Address)
If C.Value = Cell.Value Then
.Cells(i, 3).Value = C.Offset(0, -1).Value
i = i + 1
End If
Next
End If
Next
End With
End Sub