Got this error when I use "loop until" in the same module

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shogot99
    New Member
    • Feb 2008
    • 1

    Got this error when I use "loop until" in the same module

    Till here the info gotten is ok

    Loop Until strainfo = ""
    ScreenMNS.WaitH ostQuiet (400)

    Second process

    Copy "B" & paste in "E"

    Range("B2:B600" ).Select
    Selection.Copy
    Range("E2").Sel ect
    ActiveSheet.Pas te
    Selection.Repla ce What:=" ", Replacement:="" , LookAt:=xlPart, _
    SearchOrder:=xl ByRows, MatchCase:=Fals e, SearchFormat:=F alse, _
    ReplaceFormat:= False




    then I want to star other process from E2 and the error is on the next loop until

    it say´s
    " loop without do


    this is what I just add


    Loop Until strcontrol = ""
    ScreenMNS.WaitH ostQuiet (400)
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by shogot99
    Till here the info gotten is ok


    " loop without do


    this is what I just add


    Loop Until strcontrol = ""
    ScreenMNS.WaitH ostQuiet (400)
    LOOP is for closing DO, e.g.

    [CODE=vb]dim i as long
    dim j as long
    i=1
    do
    j = j+i
    i = i+1
    loop until i > 10[/CODE]

    this will make j = 55 (the sum from 1 to 10)

    HTH

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Yes, the Loop statement goes at the end of a loop, not the start.

      Comment

      Working...