|
楼主 |
发表于 2021-3-25 10:25
|
显示全部楼层
本帖最后由 于箱长 于 2021-3-25 11:15 编辑
- Sub 替代vlookup()
- Dim Arr抛光移除量, Arrvlookup, Dic As Object
- Set Dic = CreateObject("scripting.dictionary")
- Arr抛光移除量 = Sheets("抛光移除量").Range("a2:aq" & Sheets("抛光移除量").[a1].End(4).Row)
- Arrvlookup = Range("a2:m" & [a1].End(4).Row)
- For i = 1 To UBound(Arr抛光移除量)
- Dic(Arr抛光移除量(i, 8)) = Arr抛光移除量(i, 36)*1000
- Next
-
- For i = 1 To UBound(Arrvlookup)
- If Dic.exists(Arrvlookup(i, 1)) Then
- Arrvlookup(i, 11) = Dic(Arrvlookup(i, 1))
- Else
- Arrvlookup(i, 11) = 0
- End If
- Next
- [k2].Resize(UBound(Arrvlookup), 1) = Application.index(Arrvlookup, , 11)
- MsgBox "ok"
- End Sub
复制代码 |
|