Garry, you put the DO WHILE loop within the FOR LOOP. You'll never
get out of it.
Geez.., you're right! I meant to not include it because I didn't see
any reason for it being there since the only time code will execute is
if the values fall into the Case scenarios. Also, last Case scenario
needs a range...
Sub MyValueOffset_2()
* Dim i As Integer
* For i = 6 To 250
* Select Case Cells(i, 14).Value
* * * Case = 20: Cells(i, 14).Offset(0, 21).Value = 1
* * * Case 9 To 12: Cells(i, 14).Offset(0, 21).Value = 2
* * * Case 7, 8: Cells(i, 14).Offset(0, 21).Value = 3
* * * Case 1 To 5: Cells(i, 14).Offset(0, 21).Value = 4
* * End Select 'Cells(i, 14).Value
* Next
End Sub
Also, I was going to offer the following cell formula that can be
copied down so values are calced automatically...
In cell AI6 enter:
=IF($N6=20,1,IF(AND($N6<19,$N612),2,IF(AND($N6<9 ,$N66),3,IF(AND($N6=1,$N6<5),4,""))))
...and copy down as needed.
--
Garry
Free usenet access at
http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc