|
Sub 成绩分析()
Dim ar As Variant, cr As Variant
Dim i As Long, r As Long, rs As Long
Dim br()
With Sheets("学年")
r = .Cells(Rows.Count, 2).End(xlUp).Row
y = .Cells(4, Columns.Count).End(xlToLeft).Column
If r < 5 Then MsgBox "导入蔬菜定价 工作表为空,请先导入数据!": End
ar = .Range("a2:p" & r)
End With
y = 2
With Sheets("学年前N统计")
.UsedRange.Offset(5).Borders.LineStyle = 0
.UsedRange.Offset(5) = Empty
For j = 6 To 15
x = .Cells(4, y + 2)
n = 0
ReDim br(1 To UBound(ar), 1 To 5)
For i = 2 To UBound(ar)
If ar(i, j) <> "" Then
If IsNumeric(ar(i, j)) Then
If ar(i, j) >= x Then
n = n + 1
br(n, 1) = ar(i, 3)
br(n, 2) = ar(i, 4)
br(n, 3) = ar(i, j)
br(n, 4) = ar(i, 16)
br(n, 5) = ar(i, 2)
End If
End If
End If
Next i
.Cells(6, y).Resize(n, UBound(br, 2)) = br
.Cells(6, y).Resize(n, UBound(br, 2)).Borders.LineStyle = 1
y = y + 6
Next j
End With
MsgBox "ok!"
End Sub
|
|