Select Case with Comparison operators
Public Function AssignGrade(studentScore As Single) As String
Select Case studentScore
Case 90 To 100
AssignGrade = "A"
Case Is >= 80
AssignGrade = "B"
Case 70 To 80
AssignGrade = "C"
Case Is >= 60
AssignGrade = "D"
Case Else
AssignGrade = "F"
End Select
End Function
Sub test()
MsgBox AssignGrade(99)
End Sub
Related examples in the same category