|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
ahyyf 发表于 2013-12-25 22:03
赵老师:您好,还想请您帮忙解决一下这个问题,在附件中。谢谢! - Sub Macro1()
- Dim arr, brr, crr(), d As Object, i&, r
- Set d = CreateObject("scripting.dictionary")
- arr = Sheets("地生考试成绩").Range("A1").CurrentRegion
- For i = 2 To UBound(arr)
- d("" & arr(i, 1)) = i
- Next
- With Sheets("中考成绩")
- brr = .Range("A1").CurrentRegion
- ReDim crr(2 To UBound(brr), 1 To 3)
- For i = 2 To UBound(brr)
- r = d("" & brr(i, 1))
- If r <> "" Then
- crr(i, 1) = arr(r, 5)
- crr(i, 2) = arr(r, 6)
- If brr(i, 2) <> arr(r, 2) Then crr(i, 3) = arr(r, 2)
- End If
- Next
- .[k2].Resize(i - 2, 3) = crr
- End With
- End Sub
复制代码 |
|