View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default stop looping and comments on VBA

Use a 'Exit For' statement? Or, better yet, use a Do...Until (or Do
While...) loop

If you do share code, please format it for readability.

Also, in general, it is not the done thing to use the same variable as
loop index variable and the loop control variable. It might work with
VBA because it establishes controls only once. But, in languages that
reevaluate the controls each iteration, 'for x=x to x+100' would create
an infinite loop.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , shaharul
says...
I would apprecite if anybody could give any comment on the VBA code I
wrote below. It works, but I fell there is a lot need to be improved.
Especially the looping for x where i have to stop it at x + 100 because
I wouldn't know the value of x. Does anybody have any idea how to stop
x before it reached x + 100.

Thank you very much.

Sub UpdateCheque()

{snip of unformatted code}