Sub MultipleSearch()
Dim aNum(), aTabl(), aRes()
Dim i As Long, k As Long, n As Long
With Worksheets("List1")
i = .Cells(.Rows.Count, "A").End(xlUp).Row
aTabl = .Range("A1:G" & i).Value
End With
With Worksheets("List2")
i = .Cells(.Rows.Count, "D").End(xlUp).Row
aNum = .Range("D1:D" & i).Value
ReDim aRes(1 To i + 3, 1 To 1)
aRes(1, 1) = .Range("K1").Value
End With
For i = 2 To UBound(aNum)
n = i
For k = 2 To UBound(aTabl)
If aTabl(k, 1) <> Empty Then
If aNum(i, 1) = aTabl(k, 1) Then
aRes(n, 1) = aTabl(k, 7): n = n + 1
End If
End If
Next k
Next i
Worksheets("List2").Range("K1").Resize(UBound(aRes), 1).Value = aRes
End Sub
您好。我有一个代码,它在4.column中的图片1上查找值,在1.column中的图片2上的值,当它匹配时,它会从图8中的8.column返回值。 我需要做出改变。我需要以其他方式从8.column返回值。
当它的第一场比赛26054112我需要从8.column返回第一个数字 - -10629425,25 当它的第二场比赛26054112我需要返回第二个数字 - -1549761,31 等等...