請測試看看,謝謝
Sub test()
Dim Arr, xD, i&
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([工作表2!d1], [工作表2!e65536].End(3))
For i = 2 To UBound(Arr): xD(Arr(i, 1)) = Arr(i, 2): Next
With Sheets("工作表1")
Arr = .Range(.[c1], .[b65536].End(3))
For i = 1 To UBound(Arr)
If Arr(i, 1) = "" Then GoTo 99
If xD.Exists(Arr(i, 1)) Then
Arr(i, 2) = xD(Arr(i, 1))
Else
Arr(i, 2) = "錯誤"
End If
99: Next
.[b1].Resize(UBound(Arr), 2) = Arr
End With
End Sub作者: wayne0303 時間: 2022-2-19 15:15