Option Explicit
Sub TEST()
Dim Brr, Crr, Z, i&, s%, T$
Set Z = CreateObject("Scripting.Dictionary")
For s = 2 To 4
Brr = Range(Sheets(s).[B3], Sheets(s).[A65536].End(3))
For i = 1 To UBound(Brr)
T = Format(Trim(Brr(i, 1)), "0000"): If T = "" Then GoTo i01
If Z(T) = "" Then Z(T) = Brr(i, 2) & "" Else MsgBox T & " 重複": Exit Sub
i01: Next
Next
Crr = Range(Sheets(1).[B7], Sheets(1).[B65536].End(3))
For i = 1 To UBound(Crr)
Crr(i, 1) = Z(Format(Trim(Crr(i, 1)), "0000"))
Next
Sheets(1).[D7].Resize(UBound(Crr)) = Crr
End Sub作者: aassddff736 時間: 2024-2-9 09:02