I have Range("A1:A4") names and Range("B1:B4") as grades. I need to their status in Range("C1:C4") . I have used Select Case in VBA for this, but it is throwing an error:
Runtime error 13 , type mismatch
Sub Grades()
Dim mark As Integer
mark = Range("B1:B4").Value
Select Case mark
Case 0 To 35
Range("C1:C4").Value = "Fail"
Case 36 To 59
Range("C1:C4").Value = "Pass"
Case 60 To 79
Range("C1:C4").Value = "Class"
Case 80 To 89
Range("C1:C4").Value = "Distinction"
Case 90 To 100
Range("C1:C4").Value = "Excellent"
Case Else
MsgBox "no text entered"
End Select
End Sub
mark = Range("B1:B4").Valueyou setmarkas int then try to store array to it. Edit: you can do afor each e in markfollowed by your case statement.