如图
代码如下
Sub 评级()
Dim x%
x = 1
Do
x = x + 1
If Cells(x, 1) >= 90 Then
Cells(x, 2) = "优秀"
ElseIf Cells(x, 1) >= 80 Then
Cells(x, 2) = "良好"
ElseIf Cells(x, 1) >= 60 Then
Cells(x, 2) = "中等"
Else
Cells(x, 2) = "极差"
If x >= 11 Then Exit Sub
End If
Loop
End Sub
测试的时候发现多循环一次,为什么?