已知得分,想添加序号和评价(优秀良好几个不及格)
分值 序号 评价
80
60
50
30
70
代码这样写程序不运行。
Option Explicit
Dim i%, xrow1%, j%, xrow2%, c%, d%, b%
Sub test()
xrow1 = 1
For i = 1 To 9 Step 2
c=Cells(xrow1, "c").Value
c= i
xrow1 = xrow1 + 1
Next
xrow2 = 1
b=Cells(xrow2, "b").Value
d=Cells(xrow2, "d").Value
For j = 1 To 5 Step 1
Select Case b
Case Is > 90
d= "优秀"
Case Is >= 80
d = "良好"
Case Is >= 60
d = "及格"
Case Else
d = "不及格"
End Select
xrow2 = xrow2 + 1
Next j
End Sub
必须要这样写才能运行
Option Explicit
Dim i%, xrow1%, j%, xrow2%, c%, d, b
Sub test()
xrow1 = 1
For i = 1 To 9 Step 2
Cells(xrow1, "c").Value = i
xrow1 = xrow1 + 1
Next
xrow2 = 1
For j = 1 To 5 Step 1
Select Case Cells(xrow2, "b").Value
Case Is > 90
Cells(xrow2, "d").Value = "优秀"
Case Is >= 80
Cells(xrow2, "d").Value = "良好"
Case Is >= 60
Cells(xrow2, "d").Value = "及格"
Case Else
Cells(xrow2, "d").Value = "不及格"
End Select
xrow2 = xrow2 + 1
Next j
End Sub
这是为什么啊??