|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- With Worksheets("总表")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- c = .Cells(1, .Columns.Count).End(xlToLeft).Column
- arr = .Range("a1").Resize(r, c)
- End With
- For j = 3 To UBound(arr, 2) Step 7
- ReDim brr(1 To UBound(arr) - 2, 1 To 10)
- For i = 3 To UBound(arr)
- brr(i - 2, 1) = arr(i, 1)
- brr(i - 2, 2) = arr(i, 2)
- brr(i - 2, 3) = arr(i, j + 6)
- brr(i - 2, 5) = arr(i, j + 1)
- brr(i - 2, 7) = arr(i, j + 3)
- brr(i - 2, 9) = arr(i, j + 5)
- Next
- For Each q In Array(3, 5, 7, 9)
- d1.RemoveAll
- For i = 1 To UBound(brr)
- If Len(brr(i, q)) <> 0 Then
- d1(brr(i, q)) = d1(brr(i, q)) + 1
- End If
- Next
- nn = 1
- kk = d1.keys
- For k = 0 To UBound(kk)
- mm = Application.Large(kk, k + 1)
- ss = d1(mm)
- d1(mm) = nn
- nn = nn + ss
- Next
- For i = 1 To UBound(brr)
- If Len(brr(i, q)) <> 0 Then
- brr(i, q + 1) = d1(brr(i, q))
- End If
- Next
- Next
-
- d(arr(1, j)) = brr
- Next
- With Worksheets("分析表")
- .Cells.Clear
- .Range("e:e,g:g,i:i").NumberFormatLocal = "0.00%"
- r = 1
- s = 0
- For Each aa In d.keys
- s = s + 1
- brr = d(aa)
- With .Cells(r, 1)
- .Value = aa
- .Resize(1, 10).Merge
- End With
- With .Cells(r + 1, 1).Resize(1, 10)
- .Value = Array("初一年级", "统计人数", "平均分", "名次", "优秀率", "名次", "良好率", "名次", "合格率", "名次")
- End With
- With .Cells(r + 2, 1).Resize(UBound(brr), UBound(brr, 2))
- .Value = brr
- End With
- With .Cells(r, 1).Resize(2 + UBound(brr), UBound(brr, 2))
- .Borders.LineStyle = xlContinuous
- .BorderAround LineStyle:=xlContinuous, Weight:=xlMedium
- If s Mod 2 = 0 Then
- .Interior.Color = 15132391
- End If
- End With
- r = r + 2 + UBound(brr)
- Next
- With .Range("a1:j" & r - 1)
- With .Font
- .Name = "微软雅黑"
- .Size = 12
- End With
- End With
- .Rows(1).Resize(r - 1).RowHeight = 18
- With .UsedRange
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|