case question

  • Thread starter Thread starter john
  • Start date Start date
J

john

Looking at a range, say B7 to B1000, if B contains 787 or 790 to 794,
I want to change the cell in column A of that row to 8. I think, if I
undarstand correctly, that this is where one would use the case
function. I don't understand the function, though - I'm a poor
programmer, to put it mildly. How do I do this?

thanks
 
john said:
Looking at a range, say B7 to B1000, if B contains 787 or 790 to 794,
I want to change the cell in column A of that row to 8. I think, if I
undarstand correctly, that this is where one would use the case
function. I don't understand the function, though - I'm a poor
programmer, to put it mildly. How do I do this?

Like this:

For n = 7 To 1000
Select Case Cells(n, 2).Value
Case 787, 790 To 794
Cells(n, 1).Value = 8
End Select
Next
 
Back
Top