Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) <> "A1" Then Exit Sub
Dim arr, i
arr = ActiveSheet.UsedRange
For i = 3 To UBound(arr)
If arr(i, 1) = arr(1, 1) Then
[a2] = arr(i, 1)
[b2] = arr(i, 2)
[c2] = arr(i, 3)
Exit Sub
End If
Next i
End Sub
代码粘贴到指定的工作表中,在A1输入内容即可,只是针对首个找到的结果,如果有多个结果需增加代码进行判断。
If Target.Address(0, 0) <> "A1" Then Exit Sub
Dim arr, i
arr = ActiveSheet.UsedRange
For i = 3 To UBound(arr)
If arr(i, 1) = arr(1, 1) Then
[a2] = arr(i, 1)
[b2] = arr(i, 2)
[c2] = arr(i, 3)
Exit Sub
End If
Next i
End Sub
代码粘贴到指定的工作表中,在A1输入内容即可,只是针对首个找到的结果,如果有多个结果需增加代码进行判断。