|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test2()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("原始表")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:m" & r)
- For i = 1 To UBound(arr)
- xm = arr(i, 4) & "+" & arr(i, 7)
- If Not d.exists(xm) Then
- Set d(xm) = CreateObject("scripting.dictionary")
- End If
- d(xm)(i) = Empty
- Next
- End With
- With Worksheets("目标表")
- .ResetAllPageBreaks
- .Cells.Clear
- r = 1
- End With
- With Worksheets("模板")
- For Each aa In d.keys
- ReDim brr(1 To 10, 1 To 6)
- m = 0
- For Each bb In d(aa).keys
- m = m + 1
- brr(m, 1) = m
- brr(m, 2) = arr(bb, 2)
- brr(m, 3) = arr(bb, 3)
- brr(m, 4) = arr(bb, 4)
- brr(m, 5) = arr(bb, 7)
- brr(m, 6) = arr(bb, 8)
- Next
- x = d(aa).keys()(0)
- .Range("a1") = arr(x, 5) & "八年级体育过程性评价成绩记录表"
- With .Range("b2")
- .Value = "监考组组长:(" & arr(x, 10) & ")(" & arr(x, 11) & ")(" & arr(x, 12) & ")"
- With .Characters(Start:=7, Length:=Len(.Value) - 6).Font
- .ColorIndex = 3
- .Color = -16776961
- End With
- End With
- With .Range("j2")
- .Value = "性别:" & arr(x, 4) & Space(1) & "人数:" & m
- .Font.ColorIndex = 3
- End With
- .Range("g3") = arr(x, 10)
- .Range("i3") = arr(x, 11)
- .Range("k3") = arr(x, 12)
- .Range("a5").Resize(UBound(brr), UBound(brr, 2)) = brr
- .Range("a1:m15").Copy Worksheets("目标表").Cells(r, 1)
- r = r + 14
- With Worksheets("目标表")
- .HPageBreaks.Add before:=.Rows(r)
- End With
- Next
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|