Problem with For Each loop
Thanks, that was the problem.
Les
"FSt1" wrote:
hi
you are getting a deceptive error. from your code i see you are missing an
end if
add that in and your next without for error should go away.
ie
For Each Cell In Selection
If Right(Cell.Value, 4) = "-Inc" Then
begexprng = begexprng + 1
End If
Next Cell
regards
FSt1
Regards
FSt1
"WLMPilot" wrote:
I have the following code:
begexprng = 0
Range("A" & begrng & ":A" & endrng).Select
For Each Cell In Selection
If Right(Cell.Value, 4) = "-Inc" Then
begexprng = begexprng + 1
Next Cell
I am trying to select a group of cells in column A and count the ones that
have
"-Inc". It should count any cell with either "1-Inc" or "2-Inc" There are
other values in column A also.
The problem is I am getting a compile error: Next without For.
Any ideas?
Thanks,
Les
|