|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
代码如下。。。
Sub test()
Dim d As New Dictionary
Dim brr(1 To 10000, 1 To 5)
Dim Brow, Bcol
Dim arr, x, k, kk, kkk
With Sheet1
arr = .Range("a2:d" & Range("a65536").End(xlUp).Row)
For i = 1 To UBound(arr)
s = arr(i, 2)
If Not d.Exists(s) Then Set d(s) = CreateObject("scripting.dictionary")
ss = arr(i, 3)
If Not d(s).Exists(ss) Then Set d(s)(ss) = CreateObject("scripting.dictionary")
sss = arr(i, 4)
d(s)(ss) = sss
Next
For Each k In d.Keys
x = x + 1
brr(x, 1) = x
brr(x, 2) = k
Key = d(k).Keys
For Each kk In d(k).Keys
If kk = "语文" Then
brr(x, 3) = d(k)(kk)
ElseIf kk = "数学" Then
brr(x, 4) = d(k)(kk)
Else
brr(x, 5) = d(k)(kk)
End If
Next
Next
.[p2].CurrentRegion.Offset(1) = Empty
.[p2].Resize(x, 5) = brr
End With
Set d = Nothing
Beep
End Sub
|
评分
-
1
查看全部评分
-
|