Want to modify module, text rating is not accepted.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The following is a module which I use and works great , but what if I want
the rating to be a series of letters instead of returning a 1, 2, 3, 4 or 5?

Public Function GetDRIVERating(dblDRIVE As Double) _
As Integer
Select Case dblDRIVE
Case Is < 50
GetDRIVERating = 1
Case Is < 55
GetDRIVERating = 2
Case Is < 60
GetDRIVERating = 3
Case Is < 65
GetDRIVERating = 4
Case Else
GetDRIVERating = 5
End Select
End Function
 
Change to function to "As String", add quotes to character. See below

Public Function GetDRIVERating(dblDRIVE As Double) _
As String
Select Case dblDRIVE
Case Is < 50
GetDRIVERating = "A"
Case Is < 55
GetDRIVERating = "B"
Case Is < 60
GetDRIVERating = "C"
Case Is < 65
GetDRIVERating = "D"
Case Else
GetDRIVERating = "E"
End Select
End Function
 
Back
Top