Generate a VBA function that receives a test score for a student from Excel, and
ID: 3873897 • 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
Function marks(marks As Integer)
if(marks>=90 And marks<=100) Then
MsgBox("A")
ElseIf(marks>=80 And marks<90) Then
MsgBox("B")
ElseIf(marks>=70 And marks<80) Then
MsgBox("C")
ElseIf(marks>=60 And marks<70) Then
MsgBox("D")
ElseIf(marks>=0 And marks<60) Then
MsgBox("F")
Else
MsgBox("Bad Test Score")
EndIf
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.