View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default last try - do until range

each IF has to be terminated with an end if

If condition then
' things to do if true

End if

so just make sure you have matching endif "blocked" around your instructions
that you want to execute.

You do have what we call a single line IF statement and that is fine

If condition then Exit Do

that one is fine by itself since the action to take is on the same line.

--
Regards,
Tom Ogilvy



"NadiaR" wrote:

I am really new to VB, what do I need to do to correct this..thanks!

Tom Ogilvy wrote:
I am trying to do a loop and i get a message box that says loop without do.


If you take the meat out of your macro and just look at the structu

Do Until Range("xcolumn" & 6) = ""
If Range("L1") = "Jan-06" Then



If Range("AE" & xrow) = "Feb-06" Then

End If

If Range("AF" & xrow) = "Mar-06" Then

Loop

End Sub

you see you have two IF statements that are never terminated with End IF.
Since you loop statement appears in the "middle" of an If statement with no
Do within the IF statement, you get the error.

I am trying to do a loop and i get a message box that says loop without do.
xrow = 5

[quoted text clipped - 63 lines]
Mar-04 221 212 212
Apr-04 180 167 167