Hello again,
i want to create a macro that will compute the rating. when I run the macro and click the button,
I receive Run-time Error '13': Type Mismatch when I try to run the code. Debug highlights the 'IF' statements, but I can't figure out where the mistake is. Any help would be appreciated. Thanks
Private Sub CommandButton1_Click()
Dim score As Integer, result As String
rating = Range("E6:E20").Value
If rating > "98.5%" Then
result = "Exceeds"
ElseIf rating = "96% > 98.49%" Then
result = "Meets"
Else
result = "Needs"
End If
Range("F6:F20").Value = result
End Sub
<tbody>
</tbody>
i want to create a macro that will compute the rating. when I run the macro and click the button,
I receive Run-time Error '13': Type Mismatch when I try to run the code. Debug highlights the 'IF' statements, but I can't figure out where the mistake is. Any help would be appreciated. Thanks
Private Sub CommandButton1_Click()
Dim score As Integer, result As String
rating = Range("E6:E20").Value
If rating > "98.5%" Then
result = "Exceeds"
ElseIf rating = "96% > 98.49%" Then
result = "Meets"
Else
result = "Needs"
End If
Range("F6:F20").Value = result
End Sub
SCORE | RATING | RANGE | RATING | |
95.00% | must be "Needs" | 98.50% - 100% | Exceeds | |
98.01% | must be "Meets" | 96% - 98.49% | Meets | |
99.00% | must be "Exceeds" | below 96% | Needs | |
99.50% | ||||
97.66% | ||||
94.50% | ||||
95.78% | ||||
98.56% | ||||
97.69% | ||||
95.45% | ||||
98.00% | ||||
99.97% | ||||
98.99% | ||||
97.97% | ||||
98.95% |
<tbody>
</tbody>