View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default for...next funny behaviour

Check your code for an If...End If construct that encompasses the Next
statement of your For...Next loop. Something like this:

For x = 1 To 10
If Len(y)=0 Then
'do something
Next x
End If

Hope this helps,

Hutch

"Steve" wrote:

I have a for next loop in my vba code. First I comment out the for and the
next statements and the code compiles correctly.

If I un-comment the for and leave the next commented out I get a "for
without next" error.

If I either un-comment the next and leave the for commented or un-comment
both the for and the next I get a "next without for" error.