Generate a VBA function that receives a test score for a student from Excel, and
ID: 3873922 • Letter: G
Question
Generate a VBA function that receives a test score for a student from Excel, and returns a letter grade for the student. Use the following criteria: o o o o o If the test score is 90 or higher, the student receives an A If the test score is 80 to 89, the student receives a B If the test score is 70 to 79, the student receives a C If the test score is 60 to 69, the student receives a D If the test score is below 59, the student receives an F Hint: A good program will guard against test scores that don't make sense! Your program function is called from with a message: "Bad Test Score" · should also check for these and return a string to the cell where the Delivery detail: You cannot use Subroutines to complete this task and only a single function is to be submitted.Explanation / Answer
How to Enter VBA code:
--------------------------------------------------------------------------------------------------------------
Public Function GetGradeLetter(Score As Double)
Select Case Score
Case Is < 60
GetGradeLetter = "F"
Case Is < 70
GetGradeLetter = "D"
Case Is < 80
GetGradeLetter = "C"
Case Is < 90
GetGradeLetter = "B"
Case Else
GetGradeLetter = "A"
End Select
End Function
Sub getgrade()
End Sub
------------------------------------------------------------
How to Use VBA code on the Excel sheet:
Macro Setting
in Excel 2010 version, you need to check on “Enable all macros” on Excel Options>Trust Center>Macro Setting to enable Macro or VBA function.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.