When ı run the code it generates a random number between 100 and 210 and ı want my j to be valued as follows but it is not hapennig like that.
It generates nubers for j but it not according to conditions that ı coded.
Range("J12").Formula = "=RANDBETWEEN(100,210)"
x = Range("J12").Value
If x < 109 And x >= 100 Then
j = 100
ElseIf x > 109 And x < 119 Then
j = 110
ElseIf x > 119 And x < 129 Then
j = 120
ElseIf x > 129 And x < 139 Then
j = 130
ElseIf x > 139 And x < 149 Then
j = 140
ElseIf x > 149 And x < 159 Then
j = 150
ElseIf x > 159 And x < 169 Then
j = 160
ElseIf x > 169 And x < 179 Then
j = 170
ElseIf x > 179 And x < 189 Then
j = 180
ElseIf x > 189 And x < 199 Then
j = 190
Else: j = 200
End If
Range("I12").Value = j
Aucun commentaire:
Enregistrer un commentaire