|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d1 = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- With Worksheets("系统")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:d" & r)
- For i = 1 To UBound(arr)
- xm = arr(i, 1) & "+" & arr(i, 2)
- d1(xm) = Array(arr(i, 3), arr(i, 4))
- Next
- End With
- With Worksheets("地区")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:d" & r)
- For i = 1 To UBound(arr)
- xm = arr(i, 1) & "+" & arr(i, 2)
- d2(xm) = Array(arr(i, 3), arr(i, 4))
- Next
- End With
- With Worksheets("报名")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- .Range("f2:i" & r).ClearContents
- arr = .Range("a2:i" & r)
- For i = 1 To UBound(arr)
- xm = arr(i, 2) & "+" & arr(i, 3)
- If d1.exists(xm) Then
- brr = d1(xm)
- arr(i, 6) = brr(0)
- arr(i, 7) = brr(1)
- Else
- arr(i, 6) = "查无"
- arr(i, 7) = "查无"
- End If
- xm = arr(i, 4) & "+" & arr(i, 5)
- If d2.exists(xm) Then
- brr = d2(xm)
- arr(i, 8) = brr(0)
- arr(i, 9) = brr(1)
- Else
- arr(i, 8) = "查无"
- arr(i, 9) = "查无"
- End If
- Next
- .Range("c:c,f:f").NumberFormatLocal = "@"
- .Range("a2").Resize(UBound(arr), UBound(arr, 2)) = arr
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|