Private Sub CommandClicking_Click() Dim m As Integer Dim g As String Randomize Timer m = Int(Rnd * 100) Cells(10, 1).Value = m If m < 35 And m >= 0 Then g = "F" Cells(11, 1).Value = g ElseIf m < 55 And m >= 35 Then g = "E" Cells(11, 1).Value = g ElseIf m < 65 And m >= 55 Then g = "D" Cells(11, 1).Value = g ElseIf m < 75 And m >= 65 Then g = "B" Cells(11, 1).Value = g ElseIf mark < 90 And mark >= 75 Then g = "A" Cells(11, 1).Value = g ElseIf mark < 100 And mark >= 90 Then grade = "A*" Cells(11, 1).Value = g End If End Sub