|
Sub chengjitj()
Dim i, j, k, irow, irow1, kk, m, n, p, q, s, ss, t
Dim ar, br, tepar
irow = Sheets("学生原始成绩").[a10000].End(xlUp).Row
ar = Sheets("学生原始成绩").Range("a1:n" & irow)
Dim d1, d2 As Object
Set d1 = CreateObject("scripting.dictionary")
Set d2 = CreateObject("scripting.dictionary")
br = Sheets("成绩设置").[a1].Resize(11, 6)
For j = 3 To UBound(br)
d1(br(j, 1)) = br(j, 3)
Next
For i = 3 To irow
d2(ar(i, 1)) = ""
Next
Sheets("成绩统计").[a4].Resize(1000, 38).ClearContents
ReDim tepar(1 To irow - 2, 1 To 38)
For Each kk In d2.keys
For k = 3 To irow
If kk = ar(k, 1) Then
n = n + 1
For m = 1 To 14
tepar(n, m) = ar(k, m)
Next
For p = 15 To 23
tepar(n, p) = tepar(n, p - 9) * d1(ar(2, p - 9))
Next
End If
Next
With Sheets("成绩统计")
irow1 = .[a10000].End(xlUp).Row
.Cells(irow1 + 1, 1).Resize(n, 38) = tepar
For s = irow1 + 1 To irow1 + n
.Cells(s, 33) = WorksheetFunction.Sum(.Cells(s, 7).Resize(1, 8))
.Cells(s, 36) = WorksheetFunction.Sum(.Cells(s, 15).Resize(1, 8))
Next
For ss = irow1 + 1 To irow1 + n
.Cells(ss, 34) = WorksheetFunction.Rank(.Cells(ss, 33), .Cells(irow1 + 1, 33).Resize(n, 1))
.Cells(ss, 37) = WorksheetFunction.Rank(.Cells(ss, 36), .Cells(irow1 + 1, 36).Resize(n, 1))
Next
End With
n = 0
Next
With Sheets("成绩统计")
irow1 = .[a10000].End(xlUp).Row
For q = 4 To irow1
.Cells(q, 35) = WorksheetFunction.Rank(.Cells(q, 33), .Cells(4, 33).Resize(irow1 - 3, 1))
.Cells(q, 38) = WorksheetFunction.Rank(.Cells(q, 36), .Cells(4, 36).Resize(irow1 - 3, 1))
For t = 24 To 32
.Cells(q, t) = WorksheetFunction.Rank(.Cells(q, t - 9), .Cells(4, t - 9).Resize(irow1 - 3, 1))
Next
Next
End With
MsgBox "ok"
End Sub
|
|