Hello,
I am currently working on an assignment for school which has asked me to create a button that when clicked it determines a letter grade based off a percent in a cell. I have written what I think would do the trick but I keep getting error codes saying "compile error, expected end sub". I am new to programming and VBA so any help would be appreciated.
This is what my code looks like right now
Sub Button29_Click()
Private Sub cmdGrade_Click()
' Calculation of grade based on percent in G17
Dim sngPercent As Double
sngPercent = Range("B3").Value
If sngPercent >= 0.85 Then
Range("H17") = "A"
ElseIf sngPercent >= 0.7 Then
Range("H17") = "B"
ElseIf sngPercent >= 0.6 Then
Range("H17") = "C"
ElseIf sngPercent >= 0.5 Then
Range("H17") = "D"
Else
Range("H17") = "F"
End If
End Sub
Any feedback or help would be great, (I am not looking for someone to do the project for me just looking for guidance/assistance)
Bookmarks