excel - Every time i try to use GOTO statement to repeat a loop my macro fails to compile -


for project of mine trying produce macro in vba purpose of goto statement repeat while loop until forced stop.

every time try run program vba applications freezes , no error seems apparent can suggest why might happening , if there fixes

sub buses()     test.caption = day     dim mytime string 'intiger showing current time     mytime = "string" ' testing perpus      dim counter integer 'intiger value counter     counter = 1 'counter set @ 0      dim record integer 'intiger value record     jump      while counter < 20 'repeat if statment untill counter reaches 20     counter = counter + 1 ' upon repeating counter has increased 1      if mytime = cstr(thisworkbook.sheets("mon a").range("a" & counter).value)     'if current time = time of due arive bus      record = counter 'record value , counter value same          v1f1.caption = cstr(thisworkbook.sheets(day).range("a" & record).value) 'display record information on screen         v1f2.caption = cstr(thisworkbook.sheets(day).range("b" & record).value)         v1f3.caption = cstr(thisworkbook.sheets(day).range("c" & record).value)      record = record + 1          v2f1.caption = cstr(thisworkbook.sheets(day).range("a" & record).value) 'display record information on screen         v2f2.caption = cstr(thisworkbook.sheets(day).range("b" & record).value)         v2f3.caption = cstr(thisworkbook.sheets(day).range("c" & record).value)      record = record + 1          v3f1.caption = cstr(thisworkbook.sheets(day).range("a" & record).value) 'display record information on screen         v3f2.caption = cstr(thisworkbook.sheets(day).range("b" & record).value)         v3f3.caption = cstr(thisworkbook.sheets(day).range("c" & record).value)          exit  'break      end if 'end if statment      application.wait dateadd("s", 1, now) 'wait 1 second      loop ' loop result of if stament not being executed      goto jump: 'repeat while  end sub 

how moving counter = 1 after "jump". next time use loop.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -