发布网友 发布时间:2022-04-22 23:05
共1个回答
热心网友 时间:2023-09-19 04:02
'字典的,速度有保证。调用id_addr函数,参数可以是完整也可以是前六位,返回对应地址
Function id_addr(ByVal id)
Dim i, d, k, v
Set d = CreateObject("scripting.dictionary")
For i = 2 To Sheet1.UsedRange.Rows.Count
k = Sheet1.Cells(i, 1)
v = Sheet1.Cells(i, 2)
d(k) = v
Next i
k = Left(id, 6)
If d.exists(k) Then id_addr = d(k) Else id_addr = ""
Set d = Nothing
End Function