Excel Home
全球知名的Excel资源网站之一

用IF语句为单元格中的成绩评定等次

本文为:《别怕,Excel VBA其实很简单(第3版)》随书问题参考答案

要解决本例的问题,可以使用下面的过程:

Sub 为成绩评定等次()
If Range("B2").Value >= 0 Then
If Range("B2").Value <= 100 Then If Range("B2").Value >= 90 Then
Range("C2").Value = "优秀"
Else
If Range("B2").Value >= 80 Then
Range("C2").Value = "良好"
Else
If Range("B2").Value >= 60 Then
Range("C2").Value = "及格"
Else
Range("C2").Value = "不及格"
End If
End If
End If
Else
Range("C2").Value = "非法数据"
End If
Else
Range("C2").Value = "非法数据"
End If
End Sub

赞(21)
未经允许不得转载:ExcelHome » 用IF语句为单元格中的成绩评定等次
分享到

关于我们联系我们
本站特聘法律顾问:李志群律师   沪ICP备11019229号-2

沪公网安备 31011702000001号

征信