View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Change Criteria in Code

Well, you commented out one of your if statements and didn't comment out the
corresponding End if, so that gives an error. I couldn't get the error you
describe. If I uncomment the if statment, it compiles fine:

Sub tester15()
For Each CELL In Range("C10:M10")
If CELL.Value CELL.Offset(1, 0).Value Then
CELL.Offset(0, 2).Value = "Pick"
End If
Next

For Each CELL In Range("B9:K20")

If CELL.Value = "PICK" Then
For J = 1 To 8
If CELL.Offset(0, J).Address < "F5" Then
CELL.Offset(0, J).Value = "PICK"
End If
Next J
End If
Next CELL

End Sub

I have no idea what you are doing, so I answered the question the best I
could. What you should actually do to attain the results you desire lies in
the details you have not revealed.

--
Regards,
Tom Ogilvy

"hotherps " wrote in message
...
Tom was I supposed to replace my original For Next?
I'm getting a "For Next variable already in use"
Thanks

For Each cell In Range("C10:M10")
If cell.Value cell.Offset(1, 0).Value Then
cell.Offset(0, 2).Value = "Pick"
End If
Next

For Each cell In Range("B9:K20")

'If CELL.Value = "PICK" Then
For J = 1 To 8
If cell.Offset(0, J).Address < "F5" Then
cell.Offset(0, J).Value = "PICK"
End If
Next J
End If
Next cell


---
Message posted from http://www.ExcelForum.com/