vendredi 27 février 2015

Excel vba If And Then inputting numerical values and outputting non numerical

I am new at this and need some help - sorry if my question is a little unclear.


I want to create an If Then statement using a range of numbers (with one decimal place) as my Range, and for the output to be in non numerical form (a word or code)


This is what I have, when I first tried it, it worked. I saved it but it now stopped working and after clicking on the command button, nothing happens.



Dim score As Double, result As String

If Range("E2") >= 18.6 And Range("E2") <= 21.5 Then
Range("F2") = "2a"

Else
If Range("E2") >= 21.6 And Range("E2") <= 24.5 Then
Range("F2") = "3c"

End If
End If


So If I enter a number between 18.6 and 21.5 in cell E2, I would like the code "2a" to appear in cell F2.


Aucun commentaire:

Enregistrer un commentaire