|
Option Explicit
Sub TEST1()
Dim ar, i&, j&, isFlag As Boolean, iNum&
With [A1].CurrentRegion
.Columns(.Columns.Count).Offset(1).Clear
ar = .Value
For i = 2 To UBound(ar)
isFlag = True: iNum = 0
For j = 3 To UBound(ar, 2) - 1
If ar(i, j) = "优秀" Then
iNum = iNum + 1
ElseIf ar(i, j) <> "良好" Then
isFlag = False
End If
Next j
If isFlag Then
Select Case iNum
Case Is >= 19
ar(i, UBound(ar, 2)) = "五钻学生"
Case Is >= 16
ar(i, UBound(ar, 2)) = "四钻学生"
Case Is >= 13
ar(i, UBound(ar, 2)) = "三钻学生"
End Select
End If
Next i
.Value = ar
End With
Beep
End Sub |
|