加两个循环即可: Private Sub 查找_Click() With Sheets("Sheet1") y = [A65536].End(xlUp).Row For i = 2 To y For Each c In .Range("A2:A" & .[A65536].End(xlUp).Row) If c = Cells(i, 1).Value Then x = c.Row If Cells(i, 2) = "" Then Cells(i, 2).Value = .Cells(x, 2).Value Else Cells(i, 2).Value = Cells(i, 2).Value & "," & .Cells(x, 2).Value End If End If Next c Next End With End Sub
5W0qkBRB.rar
(9.85 KB, 下载次数: 10)
|