|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
学习一下字典,打扰了
Sub test()
arr = [e1].CurrentRegion
Set d = CreateObject("scripting.dictionary")
For i = 2 To UBound(arr)
s = arr(i, 1)
If arr(i, 8) > 0 Then
If Not d.exists(s) Then
d(s) = i
Else
r = d(s)
If arr(r, 5) > arr(i, 5) Then
d(s) = i
End If
End If
End If
Next
brr = [a1].CurrentRegion
For i = 2 To UBound(brr)
s = brr(i, 1)
If d.exists(s) Then
brr(i, 2) = arr(d(s), 5)
brr(i, 3) = arr(d(s), 8)
Else
brr(i, 2) = ""
brr(i, 3) = ""
End If
Next
[a1].CurrentRegion = brr
End Sub
|
评分
-
1
查看全部评分
-
|